-1

when i run "mocha" to run all my tests i get this error:

var should = chai.should();                  ^
TypeError: Property 'should' of object #<Object> is not a function

However when I run "mocha test/filename.js" on the file in question it runs fine. The chai.should() came from a question I asked previously.

latest node/npm/mocha/chai/should

What would cause such discrepancy in such between the different runs?

thanks

Pompey Magnus
  • 2,191
  • 5
  • 27
  • 40

1 Answers1

0

It appears since mocha was loading should in earlier tests like,

var should = require('should');

and trying to use that should globally, so when it got to my

var should = chai.should();

in later tests it would bomb because it conflicted, so when running the test alone there was no conflict.

I solved this by going through all my tests and redefining my should requirement to the one above.

Pompey Magnus
  • 2,191
  • 5
  • 27
  • 40