Mocha: Warning: Could not find any test files matching pattern

Created on 26 Dec 2017  路  3Comments  路  Source: mochajs/mocha

Hi Mocha Team !

The problem :

This warning stops my tests on Circle CI V2.0 (Ubuntu 14.04, Nodejs 8.9.3) :

...
yarn test
...
$ eslint .
$ mocha "./src/migrations/index.test.js" --require babel-core/register
Warning: Could not find any test files matching pattern: ./src/migrations/index.test.js
No test files found
error Command failed with exit code 1.


I tried to fix it reading similar issues like #2895 but nothing works.

My package.json :

...
"test-migrations": "mocha \"./src/migrations/index.test.js\" --require babel-core/register",
"test": "yarn run lint && yarn run test-migrations && mocha \"./src/index.test.js\" --require babel-core/register",
...

I also tried to write the path differently like :
mocha src/migrations/index.test.js --require babel-core/registe but it doesn't work

Weird behavior :

There's not warning and everything works fine on

  • OSX
  • Ubuntu 16.04
  • Debian Jessie
  • Debian Stretch

How could i solve this problem ?

Thanks a lot !

question

All 3 comments

nobody could help during the holidays ? :) @Bamieh @boneskull @markowsiak @Munter ?

Thanks a lot ! that's quite important for us, our CI can't work with this error :/

Hello buddy,

@Aarbel This error is logged when mocha is unable to resolve the file path. Are you sure the src directory is being copied into the CI?

Please replace the test script with ls src/migrations and see what logs.

@Bamieh
ok the problem comes from docker-compose and not mocha.
My volumes aren't mounted with the host files for tests. I created an issue here : https://github.com/docker/compose/issues/5519

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamietre picture jamietre  路  3Comments

niftylettuce picture niftylettuce  路  3Comments

EdvinOlofsson picture EdvinOlofsson  路  3Comments

adamhooper picture adamhooper  路  3Comments

daleharvey picture daleharvey  路  4Comments