How can I solve "ReferenceError: expect is not defined" error message?
Try
First, in the terminal
npm install expect.js
And in your code:
var expect = require('expect');
Mocha is a test framework; you need to provide your own assertion lib as https://mochajs.org/#assertions states. Thus, expect
is indeed undefined because you never defined it.
(I recommend chai)
npm install chai
then
(see Amit Choukroune's comment pointing out to actually require chai)
then
var expect = chai.expect;