visionmedia/mocha — Issue #96: Weird error messages thrown by Mocha
Author: johnnywengluu
Created: 2011-11-29 23:16:15+00:00
State: open

I get weird internal error messages from Mocha when having this code that throws an error somewhere in the code:

person.isIn("Happy").should.be.false

Output:

..

✖ 2 of 2 tests failed:

0) Statemachine should transition to another state on event: TypeError: Cannot set property 'failed' of undefined

at Runner.fail (/usr/local/lib/node_modules/mocha/lib/runner.js:90:15)
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:294:12)
at /usr/local/lib/node_modules/mocha/lib/runner.js:319:25
at Array.1 (/usr/local/lib/node_modules/mocha/lib/runner.js:272:7)
at EventEmitter._tickCallback (node.js:192:40)

1) Statemachine should transition to another state on event: TypeError: Cannot set property 'failed' of undefined

at Runner.fail (/usr/local/lib/node_modules/mocha/lib/runner.js:90:15)
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:294:12)
at /usr/local/lib/node_modules/mocha/lib/runner.js:319:25
at Array.1 (/usr/local/lib/node_modules/mocha/lib/runner.js:272:7)
at EventEmitter._tickCallback (node.js:192:40)

✖ 2 of 2 tests failed:

0) Statemachine should transition to another state on event: TypeError: Cannot set property 'failed' of undefined

at Runner.fail (/usr/local/lib/node_modules/mocha/lib/runner.js:90:15)
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:294:12)
at /usr/local/lib/node_modules/mocha/lib/runner.js:319:25
at Array.1 (/usr/local/lib/node_modules/mocha/lib/runner.js:272:7)
at EventEmitter._tickCallback (node.js:192:40)

1) Statemachine should transition to another state on event: TypeError: Cannot set property 'failed' of undefined

at Runner.fail (/usr/local/lib/node_modules/mocha/lib/runner.js:90:15)
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:294:12)
at /usr/local/lib/node_modules/mocha/lib/runner.js:319:25
at Array.1 (/usr/local/lib/node_modules/mocha/lib/runner.js:272:7)
at EventEmitter._tickCallback (node.js:192:40)

I have to do this:

try
person.isIn("Happy").should.be.false
catch error
console.log error

to get the original error message:

{ name: 'AssertionError',
message: 'expected true to be false',
actual: undefined,
expected: undefined,
operator: undefined }