-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make [jest-cli] not error when no tests are found with --findRelatedT…
…ests, --lastCommit or --onlyChanged options (#5127)
- Loading branch information
1 parent
19376c1
commit c799a02
Showing
5 changed files
with
82 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const runJest = require('../runJest'); | ||
|
||
const DIR = path.resolve(__dirname, '../no_tests_found-test'); | ||
|
||
describe('No tests are found', () => { | ||
test('fails the test suite in standard situation', () => { | ||
const result = runJest(DIR, ['--testPathPattern', '/non/existing/path/']); | ||
const status = result.status; | ||
const stdout = result.stdout.toString(); | ||
|
||
expect(stdout).toMatch('No tests found'); | ||
expect(status).toBe(1); | ||
}); | ||
|
||
test("doesn't fail the test suite if --passWithNoTests passed", () => { | ||
const result = runJest(DIR, [ | ||
'--testPathPattern', | ||
'/non/existing/path/', | ||
'--passWithNoTests', | ||
]); | ||
const status = result.status; | ||
const stdout = result.stdout.toString(); | ||
|
||
expect(stdout).toMatch('No tests found'); | ||
expect(status).toBe(0); | ||
}); | ||
|
||
test("doesn't fail the test suite if using --lastCommit", () => { | ||
// Since there are no files in DIR no tests will be found | ||
const result = runJest(DIR, ['--lastCommit']); | ||
const status = result.status; | ||
const stdout = result.stdout.toString(); | ||
|
||
expect(stdout).toMatch('No tests found'); | ||
expect(status).toBe(0); | ||
}); | ||
|
||
test("doesn't fail the test suite if using --onlyChanged", () => { | ||
// Since there are no files in DIR no tests will be found | ||
const result = runJest(DIR, ['--onlyChanged']); | ||
const status = result.status; | ||
const stdout = result.stdout.toString(); | ||
|
||
expect(stdout).toMatch('No tests found'); | ||
expect(status).toBe(0); | ||
}); | ||
|
||
test("doesn't fail the test suite if using --findRelatedTests", () => { | ||
// Since there are no files in DIR no tests will be found | ||
const result = runJest(DIR, ['--findRelatedTests', '/non/existing/path']); | ||
const status = result.status; | ||
const stdout = result.stdout.toString(); | ||
|
||
expect(stdout).toMatch('No tests found'); | ||
expect(status).toBe(0); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters