Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert.throws calls ErrorConstructor before calling fn #220

Closed
lorenzogrv opened this issue Dec 5, 2013 · 0 comments · Fixed by #232
Closed

assert.throws calls ErrorConstructor before calling fn #220

lorenzogrv opened this issue Dec 5, 2013 · 0 comments · Fixed by #232

Comments

@lorenzogrv
Copy link
Contributor

Steps to reproduce:

> cat chai_issue.js
var assert = require('chai').assert;

function FakeErrorConstructor(){
  console.log("constructor executed");
}

assert.throws(function(){
  console.log("before");
  throw new FakeErrorConstructor();
}, FakeErrorConstructor);
> node chai_issue.js

Current output:

constructor executed
before
constructor executed

Expected output:

before
constructor executed
lorenzogrv added a commit to lorenzogrv/chai that referenced this issue Dec 5, 2013
Given a constructor as function, try to get the error name from its prototype or itself before relying on the old behaviour. Closes chaijs#220
lorenzogrv added a commit to lorenzogrv/chai that referenced this issue Jan 15, 2014
Given an error constructor as function, try to get the error name from
its prototype or itself before relying on the old behaviour.

Closes chaijs#220

Replaces [the old pull](chaijs#221) to avoid
useless commits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant