Reputation: 468
I am trying to run some Mocha tests within my Node.js app.
Here is my folder structure:
compute/
folder1/
app/
tests/
mytest.js
folder2/
app/
tests/
mytest2.js
I got a package.json
in both with mocha installed.
When I try to start a test with yarn test
, I got an error
Warning: Could not find any test files matching pattern: test
No test files found
How can I manage to run it?
Because my folders' names are "tests" and not "test" as in the default and they are not at source.
Upvotes: 0
Views: 417
Reputation: 1864
When you don't use the default folders, you need to specify them as arguments. An example follows:
mocha "folder{1,2}/**/tests/*.js"
If you want to run with only npm test
/yarn test
, then you need to update your package.json
file like following:
"scripts": {
"test": "mocha \"folder{1,2}/**/tests/*.js\"",
},
Upvotes: 1