Skip to content

Commit ab94aa4

Browse files
committed
Make [jest-cli] not error when no tests are found with --findRelatedTests, --lastCommit or --onlyChanged options
1 parent 8549900 commit ab94aa4

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151

5252
* `[jest-config]` Add `forceCoverageMatch` to allow collecting coverage from
5353
ignored files. ([#5081](https://github.com/facebook/jest/pull/5081))
54+
* `[jest-cli]` Make Jest exit without an error when no tests are found in
55+
the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options
56+
having been passed to the CLI
5457

5558
## jest 22.0.0
5659

packages/jest-cli/src/run_jest.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,12 @@ export default (async function runJest({
153153
globalConfig,
154154
);
155155

156-
if (globalConfig.passWithNoTests) {
156+
if (
157+
globalConfig.passWithNoTests ||
158+
globalConfig.findRelatedTests ||
159+
globalConfig.lastCommit ||
160+
globalConfig.onlyChanged
161+
) {
157162
new Console(outputStream, outputStream).log(noTestsFoundMessage);
158163
} else {
159164
new Console(outputStream, outputStream).error(noTestsFoundMessage);

0 commit comments

Comments
 (0)