Automattic / Automattic/expect.js
TypeError: Object explicit failure has no method 'call'
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 207
- PR merge metrics
- No merged PRs in 30d
Description
I don't completely know for sure whether this is a problem with Mocha or if it's a problem with expect.js but either way, whenever I explicitly fail, I get that message rather than whatever I have my fail message as.
Example:
## test.js:
``` js
describe('This is', function(){
var dude = new Frankenstein($("body"), window);
it("a test that will fail", function(){
expect().fail(" I, the test, did fail... therefore I passed. I am so meta.");
});
});
```
## terminal:
``` bash
$ mocha test.js
.
1 failing
1) This is a test that will fail:
TypeError: Object I, the test, did fail... therefore I passed. I am so meta. has no method 'call'
at Assertion.assert (/Users/aluhring/Sites/default/node_modules/expect.js/expect.js:99:27)
at Assertion.fail (/Users/aluhring/Sites/default/node_modules/expect.js/expect.js:470:10)
at Context. (/Users/aluhring/Sites/default/public/tests/_podder.js:99:22)
at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32)
at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:372:10)
at /usr/local/lib/node_modules/mocha/lib/runner.js:448:12
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:297:14)
at /usr/local/lib/node_modules/mocha/lib/runner.js:307:7
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:245:23)
at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:274:5)
at processImmediate [as _immediateCallback] (timers.js:330:15)
```
Being that the test is supposed to fail and that the test is failing, I'm getting the result I need but I'm not trying to get a stack trace of an error that I want to exist... but that's what I'm getting.
Is there something I'm doing wrong or is this what's supposed to happen?
Any help or direction would be appreciated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.