Skip to content

Commit

Permalink
Add an extra line when showing usage (jestjs#2539)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeliog authored and cpojer committed Jan 9, 2017
1 parent cdf6e3d commit 06ecfca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
11 changes: 11 additions & 0 deletions packages/jest-cli/src/__tests__/__snapshots__/watch-test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports[`Watch mode flows Runs Jest once by default and shows usage 1`] = `
Array [
"
Watch Usage
› Press o to only run tests related to changed files.
› Press p to filter by a filename regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.
",
]
`;
9 changes: 1 addition & 8 deletions packages/jest-cli/src/__tests__/watch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ jest.doMock('../runJest', () => (...args) => {

const watch = require('../watch');

const USAGE_MESSAGE = `
Watch Usage
› Press o to only run tests related to changed files.
› Press p to filter by a filename regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.`;

afterEach(runJestMock.mockReset);

describe('Watch mode flows', () => {
Expand All @@ -60,7 +53,7 @@ describe('Watch mode flows', () => {
watch(config, pipe, argv, hasteMap, hasteContext, stdin);
expect(runJestMock).toBeCalledWith(hasteContext, config, argv, pipe,
new TestWatcher({isWatchMode: true}), jasmine.any(Function));
expect(pipe.write).toBeCalledWith(USAGE_MESSAGE);
expect(pipe.write.mock.calls.reverse()[0]).toMatchSnapshot();
});

it('Pressing "o" runs test in "only changed files" mode', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const usage = (
chalk.dim(' \u203A Press ') + 'Enter' + chalk.dim(' to trigger a test run.'),
];
/* eslint-enable max-len */
return messages.filter(message => !!message).join(delimiter);
return messages.filter(message => !!message).join(delimiter) + '\n';
};

module.exports = watch;

0 comments on commit 06ecfca

Please sign in to comment.