I Cac Rubin
I Cac Rubin

Reputation: 319

How specify test-files with .mocharc config file

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.

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

Answers (1)

pavelsaman
pavelsaman

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

Related Questions