I do not understand how this is possible. I got this test from an example and it seems impossible for it to be failing, but it is:
expect(true).toBeTruthy();
.
PhantomJS 2.1.1 (Windows 7 0.0.0) Controller:TrivialCtrl should be truthy FAILED
undefined is not a constructor (evaluating 'expect(true).toBeTruthy()')
c:/Users/Donald/workspace/karma-trivial/spec.js:25:28
This is Karma with Chai, Mocha, and PhantomJS
I do not understand how this is possible. I got this test from an example and it seems impossible for it to be failing, but it is:
expect(true).toBeTruthy();
.
PhantomJS 2.1.1 (Windows 7 0.0.0) Controller:TrivialCtrl should be truthy FAILED
undefined is not a constructor (evaluating 'expect(true).toBeTruthy()')
c:/Users/Donald/workspace/karma-trivial/spec.js:25:28
This is Karma with Chai, Mocha, and PhantomJS
Share Improve this question asked Mar 23, 2016 at 3:43 Don SubertDon Subert 2,6766 gold badges30 silver badges37 bronze badges2 Answers
Reset to default 7The expect
function is typically used with the chai
assertion library: have you loaded this plugin?
You need to:
npm install chai karma-chai --save-dev
And add karma-chai
to your list of plugins.
Additionally, reviewing the chai docs, I'm not sure if toBeTruthy
is an operator: http://chaijs./api/bdd/.
You can however use ok
:
expect(true).to.be.ok
I replaced
expect(match).toBeTruthy();
by traditional chai
expect(match).not.be.undefined;