Daulet Amirkhanov
Daulet Amirkhanov

Reputation: 41

Mocha ignores existing .mocharc.js config file

Here is my "scripts" section of package.json:

"scripts": {
"pretest": "eslint \"**/*.js\" --ignore-pattern node_modules/",
"test": "mocha"
}

and here is my .mocharc.js:

'use strict';

module.exports = {
    diff: true,
    extension: ['js'],
    package: './package.json',
    reporter: 'landing',
    slow: 75,
    timeout: 2000,
    ui: 'bdd',
    watchFiles: ['src/tests/*.js', 'src/tests/**/*.js'],
};

When running npm test I get pretest running correctly, but mocha seems to ignore config file. Haven't seen the issue anywhere yet.

Upvotes: 0

Views: 7531

Answers (2)

cyan-kinesin
cyan-kinesin

Reputation: 704

Try running Mocha with --config options.

Example: mocha --config .mocharc.js

And your watchFiles option is wrong. It should be watch-files.

See this mocha example: https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.js

Upvotes: 4

Gyp Sud
Gyp Sud

Reputation: 93

Try adding the following to your .mocharc.js

recursive: true

Upvotes: 2

Related Questions