jest: Jest v13: `npm test` doesn't run any tests
After upgrading from v12 -> v13, I noticed our ci builds weren’t actually
running the tests. It appears if we execute jest directly the tests run, but not via npm test
Doesn’t work:
$ npm test -- --verbose
npm info it worked if it ends with ok
npm info using npm@3.10.5
npm info using node@v4.4.7
npm info lifecycle my-project@0.4.0~pretest: my-project@0.4.0
npm info lifecycle my-project@0.4.0~test: my-project@0.4.0
> my-project@0.4.0 test /builds/project-1
> jest "--verbose"
Using Jest CLI v13.2.3, jasmine2
npm info lifecycle my-project@0.4.0~posttest: my-project@0.4.0
npm info ok
Finds no tests, exits immediately (or is crashing, can’t really tell)
Does work:
$ node_modules/.bin/jest --verbose
....
3 test suites failed, 28 tests passed (28 total in 25 test suites, run time 9.348s)
Version Information
node: v4.4.7 npm: 3.10.2 jest: CLI v13.2.3, jasmine2
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 25 (12 by maintainers)
@cpojer Got this issue again. jest 23.4.2
Reproduces only in docker or ci environment. On local machine all runs fine. Tried with and without (default options)
jest.config
I just found a bug in Jest that makes it so it doesn’t find any files if the project itself is located in a temporary folder like /tmp based on what the OS thinks should be a temp folder. I’m working on a fix for that but it will probably land after the weekend. What’s the full path of the test run in your examples?
I’m also a bit confused about @ecoleman’s comment about invoking Jest directly through
node_modules/.bin/jest
– ifnpm test
maps tojest
as it does based on the example in the initial comment, it should be 100 % the same thing.Getting the same problem. We’re trying to run the tests inside a docker container too, so guessing it’s something to do with how tests are picked up inside the container. Maybe the command is executing in the wrong directory? Made a quick repository to reproduce the error here.
I converted everything to use mocha instead, and the same dockerfile runs the tests fine, you can see that on the prove_dockerfile_works_with_mocha branch of my repo. Hope this helps.
@bravely it seems like that is a separate issue. testRegex definitely does work but you are using
testFileExtensions
which we deprecated but still support. If it is present, it will overwrite thetestRegex
. We should probably make it throw if both are provided.@cpojer I’m on 14.1.0. This is my Jest config(same result whether you’re in its own config file or package.json):
Oh that sucks! It’s probably a really minor thing and I’ll try to investigate soon and hopefully publish a point release with a fix 😃
Just tried with ^14.0.0 and looks like it’s still happening 😦