3

I currently run mocha tests with npm scripts like

mocha test/mocha.js test/crc/mocha.js test/multibyte/test.js

I added additional three test files and I start to wonder maybe use configuration file like .mocharc.js, and call simply mocha, but what ever I try mocha always runs all .js files in "test" folder.

All this is so confusing and I cant find any config file documentation, more than what file names should I use.

Does anyone knows how I can run just these three test-files with config file ?

I know I can use npm script like before, but maybe there is way ?

I Cac Rubin
  • 109
  • 1
  • 7

1 Answers1

4

You can use spec:

.mocharc.json:

{
    "spec": "./test/**/*.js"    
}

Some other examples are in here: How to specify test directory for mocha?

pavelsaman
  • 7,399
  • 1
  • 14
  • 32