Skip to content

Commit

Permalink
fix the jestjs#6167 - F key misleading message
Browse files Browse the repository at this point in the history
  • Loading branch information
lgandecki committed May 14, 2018
1 parent 16de9ac commit bc9afd9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
17 changes: 17 additions & 0 deletions packages/jest-cli/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/get_no_test_found_failed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
);
}
4 changes: 3 additions & 1 deletion packages/jest-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'),
Expand Down

0 comments on commit bc9afd9

Please sign in to comment.