admin管理员组

文章数量:1401963

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.

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.

Share Improve this question edited Aug 11, 2020 at 6:26 tadman 212k23 gold badges236 silver badges265 bronze badges asked Mar 25, 2020 at 18:42 Daulet AmirkhanovDaulet Amirkhanov 412 silver badges11 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

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./mochajs/mocha/blob/master/example/config/.mocharc.js

Try adding the following to your .mocharc.js

recursive: true

本文标签: javascriptMocha ignores existing mocharcjs config fileStack Overflow