Skip to content

Commit

Permalink
fix the #6167 - F key misleading message (#6182)
Browse files Browse the repository at this point in the history
* fix the #6167 - F key misleading message

* improve the test formatting to AAA

* updated CHANGELOG

* fix the prettier warning in CHANGELOG

* final prettier tweak for the CHANGELOG
  • Loading branch information
lgandecki authored and cpojer committed May 15, 2018
1 parent 01eb4ef commit d1bdf9e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
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

0 comments on commit d1bdf9e

Please sign in to comment.