Using --findRelatedTest
doesn't seem to be compatible with specifying roots
.
Steps to reproduce the behavior:
- Make sure your tests are located in a different directory than your main code:
├── package-lock.json ├── package.json ├── src │ └── example.js └── test └── example.test.js
- Configure
roots
to point to your test dir{ "jest": { "roots": ["test"] } }
- Run
npx jest --findRelatedTests src/example.js
and see the following:No tests found, exiting with code 1 Run with `--passWithNoTests` to exit with code 0 No files found in ~/github/jest-find-related-tests-roots. Make sure Jest's configuration does not exclude this directory. To set up Jest, make sure a package.json file exists. Jest Documentation: https://jestjs.io/docs/configuration Pattern: src/example.js - 0 matches
PASS test/example.test.js
✓ should provide 42 (2 ms)
See https://github.com/nicojs/jest-find-related-tests-roots for an example.
System:
OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
Binaries:
Node: 14.16.1 - /usr/bin/node
Yarn: 1.22.10 - /usr/bin/yarn
npm: 6.14.12 - /usr/bin/npm
npmPackages:
jest: ^27.0.4 => 27.0.4