In my Javascript Unit test, expect(true).toBeTruthy() fails

Viewed 1453

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

2 Answers

I replaced

expect(match).toBeTruthy();

by traditional chai

expect(match).not.be.undefined;
Related