Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the #6167 - F key misleading message #6182

Merged
merged 5 commits into from
May 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@

### Fixes

* `[jest-cli]` Fix misleading action description for F key when in "only failed
tests" mode. ([#6167](https://github.com/facebook/jest/issues/6167))
* `[jest-worker]` Stick calls to workers before processing them
([#6073](https://github.com/facebook/jest/pull/6073))
* `[babel-plugin-jest-hoist]` Allow using `console` global variable
Expand Down
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