Closed aseemk closed 11 years ago
This is really a bug/quirk in the native assert module, but we could patch it in should.
assert
should
try { should.fail('hello world'); } catch (err) { should.exist(err.message); // fails console.log(err); }
If you comment out the should.exist, the console log gets:
should.exist
{ name: 'AssertionError', message: undefined, actual: 'hello world', expected: undefined, operator: undefined, stack: [Getter/Setter] }
So if you actually want to use the message, right now you have to do:
should.fail(null, null, 'hello world');
What do you think about patching fail to accept just a message?
fail
Fixed this as part of my message support: #13
This is really a bug/quirk in the native
assert
module, but we could patch it inshould
.If you comment out the
should.exist
, the console log gets:So if you actually want to use the message, right now you have to do:
What do you think about patching
fail
to accept just a message?