Skip to content

Commit 54b2c75

Browse files
authored
Merge pull request #1564 from cpojer/master
Press escape to leave pattern input. Fixes #1554
2 parents e42735e + 3214513 commit 54b2c75

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/jest-cli/src/SearchSource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class SearchSource {
207207
const testInfo = patternInfo.onlyChanged
208208
? ' related to changed files'
209209
: patternInfo.input !== ''
210-
? ' matching ' + testPathPattern
210+
? ' matching ' + chalk.bold(testPathPattern)
211211
: '';
212212

213213
return 'Ran all tests' + testInfo + '.';

packages/jest-cli/src/jest.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const KEYS = {
4242
CONTROL_C: '03',
4343
CONTROL_D: '04',
4444
ENTER: '0d',
45+
ESCAPE: '1b',
4546
O: '6f',
4647
P: '70',
4748
Q: '71',
@@ -250,7 +251,7 @@ const runCLI = (
250251

251252
const writeCurrentPattern = () => {
252253
clearLine(pipe);
253-
pipe.write(chalk.dim(' pattern \u203A ' + currentPattern));
254+
pipe.write(chalk.dim(' pattern \u203A ') + currentPattern);
254255
};
255256

256257
const startRun = (overrideConfig: Object = {}) => {
@@ -306,6 +307,11 @@ const runCLI = (
306307
});
307308
startRun();
308309
break;
310+
case KEYS.ESCAPE:
311+
isEnteringPattern = false;
312+
clearLine(pipe);
313+
currentPattern = argv._[0];
314+
break;
309315
default:
310316
const char = new Buffer(key, 'hex').toString();
311317
currentPattern = key === KEYS.BACKSPACE

0 commit comments

Comments
 (0)