Skip to content

Commit dfbc36c

Browse files
Add e2e test
1 parent 43e51ce commit dfbc36c

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"**/node_modules": true,
66
"**/build": true
77
},
8-
"editor.formatOnSave": false,
8+
"editor.formatOnSave": true,
99
"flow.useNPMPackagedFlow": true,
1010
"javascript.validate.enable": false,
1111
"jest.pathToJest": "yarn jest --",

e2e/__tests__/__snapshots__/watchModePatterns.test.js.snap

+51
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,57 @@ Pattern Mode Usage
1313
1414
1515
16+
`;
17+
18+
exports[`can press "p" to filter by file name with invalid regexp 1`] = `
19+
20+
Pattern Mode Usage
21+
› Press Esc to exit pattern mode.
22+
› Press Enter to filter by a filenames regex pattern.
23+
24+
pattern › 
25+
pattern › *
26+
27+
Please provide valid RegExp
28+
pattern › 
29+
pattern › [
30+
31+
Please provide valid RegExp
32+
pattern › 
33+
pattern › b
34+
pattern › ba
35+
pattern › bar
36+
37+
38+
39+
`;
40+
41+
exports[`can press "p" to filter by file name with invalid regexp: test results 1`] = `
42+
"PASS __tests__/bar.spec.js
43+
PASS __tests__/foo.spec.js"
44+
`;
45+
46+
exports[`can press "p" to filter by file name with invalid regexp: test results 2`] = `
47+
"PASS __tests__/bar.spec.js
48+
✓ bar 1
49+
✓ bar 2
50+
"
51+
`;
52+
53+
exports[`can press "p" to filter by file name with invalid regexp: test summary 1`] = `
54+
"Test Suites: 2 passed, 2 total
55+
Tests: 4 passed, 4 total
56+
Snapshots: 0 total
57+
Time: <<REPLACED>>
58+
Ran all test suites."
59+
`;
60+
61+
exports[`can press "p" to filter by file name with invalid regexp: test summary 2`] = `
62+
"Test Suites: 1 passed, 1 total
63+
Tests: 2 passed, 2 total
64+
Snapshots: 0 total
65+
Time: <<REPLACED>>
66+
Ran all test suites matching /bar/i."
1667
`;
1768
1869
exports[`can press "p" to filter by file name: test results 1`] = `

e2e/__tests__/watchModePatterns.test.js

+22
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ test('can press "p" to filter by file name', () => {
6363
expect(status).toBe(0);
6464
});
6565

66+
test('can press "p" to filter by file name with invalid regexp', () => {
67+
const input = [
68+
{keys: ['p', '*', '\r', '[', '\r', 'b', 'a', 'r', '\r']},
69+
{keys: ['q']},
70+
];
71+
72+
setupFiles(input);
73+
const {status, stdout, stderr} = runJest(DIR, [
74+
'--no-watchman',
75+
'--watchAll',
76+
]);
77+
78+
const results = extractSummaries(stderr);
79+
expect(stdout).toMatchSnapshot();
80+
expect(results).toHaveLength(2);
81+
results.forEach(({rest, summary}) => {
82+
expect(rest).toMatchSnapshot('test results');
83+
expect(summary).toMatchSnapshot('test summary');
84+
});
85+
expect(status).toBe(0);
86+
});
87+
6688
test('can press "t" to filter by test name', () => {
6789
const input = [{keys: ['t', '2', '\r']}, {keys: ['q']}];
6890
setupFiles(input);

0 commit comments

Comments
 (0)