Reputation: 319
I currently run mocha tests with npm scripts like
mocha test/mocha.js test/crc/mocha.js test/multibyte/test.js
I added an additional three test files and I started to think maybe to use a configuration file like .mocharc.js
, and call simply mocha
, but whatever I try, mocha always runs all .js files in "test" folder.
file
property, but it won't work.watch-files
property but it still won't work.file
property, but it won't work.All this is so confusing and I can't find any config file documentation more than what file names I should use.
Does anyone knows how I can run just these three test-files with a config file ?
I know I can use npm script like before, but maybe there is way ?
Upvotes: 4
Views: 4318
Reputation: 8332
You can use spec
:
.mocharc.json:
{
"spec": "./test/**/*.js"
}
Some other examples are in here: How to specify test directory for mocha?
Upvotes: 5