dimanche 13 septembre 2020

Mocha run with recursive glob pattern does not run all tests on Mac

I am using mocha for testing. I am running mocha with a recursive glob pattern (./src/**/*.test.ts) to run all my tests, but only some of them are executed. Particularly only my tests under src/utils are being run. If I give mocha ./src/handlers/**/*.test.ts as the path the tests do execute under src/handlers, but obviously this is not ideal.

I have done some refactoring on my code and before that it worked fine.

What am I doing wrong?

My project structure looks like this:

src
  |-handlers
  |    |-Connection
  |        |-tests
  |            |- handleConnection.test.ts
  |            |- handleDisconnection.test.ts
  |            |...
  |-utils
       |-utils.test.ts
       |...

I am trying to run mocha with this npm script:

"test": "mocha ./src/**/*.test.ts -r ts-node/register"

Aucun commentaire:

Enregistrer un commentaire