Running tests that match string causes non-matching suites to fail
See original GitHub issueš„ Regression Report
When I set the -t
CLI option to filter what tests are run, if there is a suite that doesnāt have any tests that match the string then it fails with:
ā Test suite failed to run
Your test suite must contain at least one test.
at node_modules/jest/node_modules/jest-cli/build/test_scheduler.js:245:22
My expectation would be that it behaves the same as v22, where any suites that have no matching tests are skipped.
Sorry if this issue already exists, I looked for it but couldnāt find anything that matched this problem. Iāve also looked in the v23 changelog and couldnāt see this being a known breaking change.
Last working version
Worked up to version: 22.4.4
Stopped working in version: 23.0.0
To Reproduce
Steps to reproduce the behavior:
Clone my repo (https://github.com/Crispioso/possible-jest-bug) and run the following commands in both /v22
and /v23
directories:
npm install
npm test
They both run the same tests and apply -t false
so that it only runs tests with the string āfalseā in their title.
v22 skips the suite which has no matching tests whereas v23 throws an error instead.
Expected behavior
v23 to skip test suites that have no tests in them that match the -t
patter, rather than error.
Link to repl or repo (highly encouraged)
https://github.com/Crispioso/possible-jest-bug
Run npx envinfo --preset jest
Paste the results here:
v23:
System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Binaries:
Node: 8.9.3 - /usr/local/bin/node
Yarn: 1.0.2 - /usr/local/bin/yarn
npm: 5.5.1 - /usr/local/bin/npm
npmPackages:
jest: 23.0.0 => 23.0.0
v22:
System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Binaries:
Node: 8.9.3 - /usr/local/bin/node
Yarn: 1.0.2 - /usr/local/bin/yarn
npm: 5.5.1 - /usr/local/bin/npm
npmPackages:
jest: 22.x => 22.4.4
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (4 by maintainers)
Top GitHub Comments
Iām getting this issue with
npm test -- -u -t="test string"
for all published versions of v23.x. My project is not using yarn and would prefer not to add another dependency so can not use the solution posted aboveItās worth noting that this only seems to be an issue with jest version >= 23.1 Rolling back to jest v22.4.4 fixes this. However, rolling back will cause flags to go up with david-dm so is less than ideal, so using jest-cli 24.x for test filtering with regex for now while leaving the package version at 23.2 as a work around
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.