Is there a way to make Mocha run tests in strict mode when running on node?
Normally you can enable this in node by running node --use_strict
. Is there a way to do the same thing for mocha
?
Strict mode example js file: const strictMode = require('./modules/strict'); strictMode. preventExtension(); And the following code in my strict.
The beforeEach method is a feature (hook) in test libraries that you can use to set preconditions for each test. Just like the name suggests, it runs before each test in your test suite. For example, the beforeEach method will run four times in a suite with four tests.
Find out how you can ignore some tests in Mocha You can use the skip() method (on describe() or it() ) to ignore some tests: In case of describe , it will ignore all tests in the describe block (which includes all nested describe and it functions); In case of it , it will ignore the individual test.
Add --use_strict
to the mocha command.
So your command might look like this :
mocha ./test --recursive --use_strict
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With