-
-
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.
Fix warning message when there are no tests (#8595)
- Loading branch information
1 parent
3f5a0e8
commit 5d42d0a
Showing
5 changed files
with
75 additions
and
0 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
25 changes: 25 additions & 0 deletions
25
packages/jest-core/src/__tests__/__snapshots__/getNoTestsFoundMessage.test.js.snap
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,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`getNoTestsFoundMessage returns correct message when monitoring only changed 1`] = `"<bold>No tests found related to files changed since last commit.</>"`; | ||
exports[`getNoTestsFoundMessage returns correct message when monitoring only failures 1`] = ` | ||
"<bold>No failed test found.</> | ||
<bold></><dim>Press \`f\` to quit \\"only failed tests\\" mode.</>" | ||
`; | ||
exports[`getNoTestsFoundMessage returns correct message with passWithNoTests 1`] = `"<bold>No tests found, exiting with code 0</>"`; | ||
exports[`getNoTestsFoundMessage returns correct message with verbose option 1`] = ` | ||
"<bold>No tests found, exiting with code 1</> | ||
Run with \`--passWithNoTests\` to exit with code 0 | ||
Pattern: <yellow>/path/pattern</> - 0 matches" | ||
`; | ||
exports[`getNoTestsFoundMessage returns correct message without options 1`] = ` | ||
"<bold>No tests found, exiting with code 1</> | ||
Run with \`--passWithNoTests\` to exit with code 0 | ||
In <bold>/root/dir</> | ||
0 files checked across 0 projects. Run with \`--verbose\` for more details. | ||
Pattern: <yellow>/path/pattern</> - 0 matches" | ||
`; |
38 changes: 38 additions & 0 deletions
38
packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.js
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,38 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
||
import getNoTestsFoundMessage from '../getNoTestsFoundMessage'; | ||
|
||
describe('getNoTestsFoundMessage', () => { | ||
function createGlobalConfig(options) { | ||
return { | ||
rootDir: '/root/dir', | ||
testPathPattern: '/path/pattern', | ||
...options, | ||
}; | ||
} | ||
|
||
test('returns correct message when monitoring only failures', () => { | ||
const config = createGlobalConfig({onlyFailures: true}); | ||
expect(getNoTestsFoundMessage([], config)).toMatchSnapshot(); | ||
}); | ||
|
||
test('returns correct message when monitoring only changed', () => { | ||
const config = createGlobalConfig({onlyChanged: true}); | ||
expect(getNoTestsFoundMessage([], config)).toMatchSnapshot(); | ||
}); | ||
|
||
test('returns correct message with verbose option', () => { | ||
const config = createGlobalConfig({verbose: true}); | ||
expect(getNoTestsFoundMessage([], config)).toMatchSnapshot(); | ||
}); | ||
|
||
test('returns correct message without options', () => { | ||
const config = createGlobalConfig(); | ||
expect(getNoTestsFoundMessage([], config)).toMatchSnapshot(); | ||
}); | ||
|
||
test('returns correct message with passWithNoTests', () => { | ||
const config = createGlobalConfig({passWithNoTests: true}); | ||
expect(getNoTestsFoundMessage([], config)).toMatchSnapshot(); | ||
}); | ||
}); |
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,7 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
||
import chalk from 'chalk'; | ||
|
||
export default function getNoTestFoundPassWithNoTests() { | ||
return chalk.bold('No tests found, exiting with code 0'); | ||
} |
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