Skip to content

Commit ac8c345

Browse files
Update --forceExit and "did not exit for one second" message colors. (#8329)
* Update --forceExit message color. * Update "Jest did not exit one second" message color. * Update CHANGELOG.md * console.error -> console.warn
1 parent c7bcefb commit ac8c345

File tree

5 files changed

+11
-20
lines changed

5 files changed

+11
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Features
44

55
- `[expect]` Improve report when matcher fails, part 15 ([#8281](https://github.com/facebook/jest/pull/8281))
6+
- `[jest-cli]` Update `--forceExit` and "did not exit for one second" message colors ([#8329](https://github.com/facebook/jest/pull/8329))
67
- `[expect]` Improve report when matcher fails, part 16 ([#8306](https://github.com/facebook/jest/pull/8306))
78
- `[jest-runner]` Pass docblock pragmas to TestEnvironment constructor ([#8320](https://github.com/facebook/jest/pull/8320))
89

e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ PASS foo/bar.spec.js
55
✓ foo
66
77
8-
Force exiting Jest
9-
10-
Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?
8+
Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?
119
`;
1210

1311
exports[`CLI accepts exact file names if matchers matched 2`] = `

e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ PASS __tests__/a-banana.js
55
✓ banana
66
77
8-
Force exiting Jest
9-
10-
Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?
8+
Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?
119
`;
1210

1311
exports[`prints console.logs when run with forceExit 2`] = `

e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`prints message about flag on forceExit 1`] = `
4-
Force exiting Jest
5-
6-
Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?
7-
`;
3+
exports[`prints message about flag on forceExit 1`] = `Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?`;
84

95
exports[`prints message about flag on slow tests 1`] = `
106
Jest did not exit one second after the test run has completed.

packages/jest-cli/src/cli/index.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,21 @@ const readResultsAndExit = (
119119

120120
if (globalConfig.forceExit) {
121121
if (!globalConfig.detectOpenHandles) {
122-
console.error(
123-
chalk.red.bold('Force exiting Jest\n\n') +
124-
chalk.red(
125-
'Have you considered using `--detectOpenHandles` to detect ' +
126-
'async operations that kept running after all tests finished?',
127-
),
122+
console.warn(
123+
chalk.bold('Force exiting Jest: ') +
124+
'Have you considered using `--detectOpenHandles` to detect ' +
125+
'async operations that kept running after all tests finished?',
128126
);
129127
}
130128

131129
exit(code);
132130
} else if (!globalConfig.detectOpenHandles) {
133131
setTimeout(() => {
134-
console.error(
135-
chalk.red.bold(
132+
console.warn(
133+
chalk.yellow.bold(
136134
'Jest did not exit one second after the test run has completed.\n\n',
137135
) +
138-
chalk.red(
136+
chalk.yellow(
139137
'This usually means that there are asynchronous operations that ' +
140138
"weren't stopped in your tests. Consider running Jest with " +
141139
'`--detectOpenHandles` to troubleshoot this issue.',

0 commit comments

Comments
 (0)