Skip to content

Commit f11e70e

Browse files
andresilveirahFacebook Github Bot 9
authored andcommitted
improve "No tests found..." message
Summary:Relates to jestjs#856 ps. I've already signed the CLA. Closes jestjs#863 Differential Revision: D3137918 fb-gh-sync-id: e58e04b4cc8c5218cc92c9ce8cf0af97b32172f7 fbshipit-source-id: e58e04b4cc8c5218cc92c9ce8cf0af97b32172f7
1 parent 7236d69 commit f11e70e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/jest.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function buildTestPathPatternInfo(argv) {
7272
if (argv.onlyChanged) {
7373
return {
7474
onlyChanged: true,
75+
watch: argv.watch !== undefined,
7576
};
7677
}
7778
if (argv.testPathPattern) {
@@ -97,7 +98,12 @@ function buildTestPathPatternInfo(argv) {
9798

9899
function getNoTestsFoundMessage(patternInfo) {
99100
if (patternInfo.onlyChanged) {
100-
return 'No tests found related to changed and uncommitted files.';
101+
const guide = patternInfo.watch
102+
? 'starting Jest with `jest --watch=all`'
103+
: 'running Jest without `-o`';
104+
return 'No tests found related to changed and uncommitted files.\n' +
105+
'Note: If you are using dynamic `require`-calls or no tests related ' +
106+
'to your changed files can be found, consider ' + guide + '.';
101107
}
102108
const pattern = patternInfo.pattern;
103109
const input = patternInfo.input;

0 commit comments

Comments
 (0)