diff --git a/packages/jest-cli/src/__tests__/watch.test.js b/packages/jest-cli/src/__tests__/watch.test.js index 21f993934d01..142230ef5e51 100644 --- a/packages/jest-cli/src/__tests__/watch.test.js +++ b/packages/jest-cli/src/__tests__/watch.test.js @@ -645,6 +645,23 @@ describe('Watch mode flows', () => { globalConfig, }); }); + + it('shows the correct usage for the f key in "only failed tests" mode', () => { + jest.unmock('jest-util'); + const util = require('jest-util'); + util.isInteractive = true; + + const ci_watch = require('../watch').default; + ci_watch(globalConfig, contexts, pipe, hasteMapInstances, stdin); + + stdin.emit(KEYS.F); + stdin.emit(KEYS.W); + const lastWatchDisplay = pipe.write.mock.calls.reverse()[0][0]; + expect(lastWatchDisplay).toMatch('Press a to run all tests.'); + expect(lastWatchDisplay).toMatch( + 'Press f to quit "only failed tests" mode', + ); + }); }); class MockStdin { diff --git a/packages/jest-cli/src/get_no_test_found_failed.js b/packages/jest-cli/src/get_no_test_found_failed.js index 737499e53f3b..0633d525a799 100644 --- a/packages/jest-cli/src/get_no_test_found_failed.js +++ b/packages/jest-cli/src/get_no_test_found_failed.js @@ -3,6 +3,6 @@ import chalk from 'chalk'; export default function getNoTestFoundFailed() { return ( chalk.bold('No failed test found.\n') + - chalk.dim('Press `f` to run all tests.') + chalk.dim('Press `f` to quit "only failed tests" mode.') ); } diff --git a/packages/jest-cli/src/watch.js b/packages/jest-cli/src/watch.js index 502789cb1343..9717940a6b8e 100644 --- a/packages/jest-cli/src/watch.js +++ b/packages/jest-cli/src/watch.js @@ -385,7 +385,9 @@ const usage = ( : null, globalConfig.onlyFailures - ? chalk.dim(' \u203A Press ') + 'f' + chalk.dim(' to run all tests.') + ? chalk.dim(' \u203A Press ') + + 'f' + + chalk.dim(' to quit "only failed tests" mode.') : chalk.dim(' \u203A Press ') + 'f' + chalk.dim(' to run only failed tests.'),