Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nudge users towards new feature
  • Loading branch information
SimenB committed May 6, 2018
commit a3ea1aa360b053a70a67e3a13fa43a708bf1ccf8
19 changes: 19 additions & 0 deletions packages/jest-cli/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,26 @@ const readResultsAndExit = (
process.on('exit', () => (process.exitCode = code));

if (globalConfig.forceExit) {
if (!globalConfig.detectOpenHandles) {
console.error(
chalk.red(
'Force exiting Jest - have you considered using `--detectOpenHandles`?',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ending with […] to detect async operations that kept running after all tests finished?

),
);
}

exit(code);
} else if (!globalConfig.detectOpenHandles) {
setTimeout(() => {
const lines = [
chalk.red.bold(
'Jest has not exited 1000ms after the test run finished',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do "Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with --detectOpenHandles to troubleshoot this issue." or something similar?

),
chalk.red('Have you considered using `--detectOpenHandles`?'),
];
console.error(lines.join('\n\n'));
// $FlowFixMe: `unref` exists in Node
}, 1000).unref();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

}
};

Expand Down