Mocha does not run all tests in the test directory

This is my folder structure.

src/
   a.js
   b.js
   test/
     a.spec.js
     b.spec.js

and I tried to run

  • ~/.../src $ mocha
  • ~/.../src $ mocha test
  • ~/.../src $ mocha test/
  • ~/.../src $ mocha ./test/
  • ~/.../src $ mocha ./test/*.js

but it doesn’t work ... all I get is just one test file, and the rest are ignored.

docs say that (1) should do the job, but it is not.

+4
source share
3 answers

Well ... I'm an idiot. I had it.onlyone of my files, and I forgot about it. The answer "t21" was the answer. All test files are now running.

Sorry for that, shame on me ...

+10
source

, , . mocha , --recursive

.

, package.json -. npm install mocha --save-dev, package.json , npm test

{
  "scripts": {
    "test": "./node_modules/.bin/mocha --recursive",
  }
}
Hide result
+6

moch.opts

-

~/.../src $mocha; .

-1

Source: https://habr.com/ru/post/1623220/


All Articles