Reputation: 41
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
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