Creating "strict use" mocha when working in node

Is there a way to do Mocha tests in strict mode when working on node?

You can usually enable this in node by running node --use_strict . Is there a way to do the same for mocha ?

+8
javascript mocha
source share
3 answers

Add --use_strict to the mocha command.

So your command might look like this:

 mocha ./test --recursive --use_strict 
+9
source share

It is not possible to pass --use_strict to mocha, and this was done on purpose. Read the discussion in more detail.

If you really want this behavior, you can use forch mocha sources or load this npm module primarily in your tests.

0
source share

I would just start test scripts with 'use strict';

-7
source share

All Articles