Skip to content

Commit 99ada77

Browse files
committed
Add more e2e tests, ensure concurrent tests end with a time gap
1 parent 3e5bb4d commit 99ada77

File tree

6 files changed

+437
-53
lines changed

6 files changed

+437
-53
lines changed
Lines changed: 179 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,230 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`runs the tests in the correct order 1`] = `
3+
exports[`all passing runs the tests in the correct order 1`] = `
44
" console.log
5-
[[beforeAll]]
5+
beforeAll
66
7-
at log (__tests__/concurrent.test.js:12:29)
7+
at log (__tests__/concurrent.test.js:15:11)
88
99
console.log
10-
[[test one start]]
10+
START "one"
1111
12-
at log (__tests__/concurrent.test.js:12:29)
12+
at log (__tests__/concurrent.test.js:15:11)
1313
1414
console.log
15-
[[test three start]]
15+
START "two"
1616
17-
at log (__tests__/concurrent.test.js:12:29)
17+
at log (__tests__/concurrent.test.js:15:11)
1818
1919
console.log
20-
[[test five start]]
20+
START "three"
2121
22-
at log (__tests__/concurrent.test.js:12:29)
22+
at log (__tests__/concurrent.test.js:15:11)
2323
2424
console.log
25-
[[test six start]]
25+
START "four"
2626
27-
at log (__tests__/concurrent.test.js:12:29)
27+
at log (__tests__/concurrent.test.js:15:11)
2828
2929
console.log
30-
[[test seven (fails) start]]
30+
START "five"
3131
32-
at log (__tests__/concurrent.test.js:12:29)
32+
at log (__tests__/concurrent.test.js:15:11)
3333
3434
console.log
35-
[[test three end]]
35+
END: "three"
3636
37-
at log (__tests__/concurrent.test.js:12:29)
37+
at log (__tests__/concurrent.test.js:15:11)
3838
3939
console.log
40-
[[test eight start]]
40+
START "six"
4141
42-
at log (__tests__/concurrent.test.js:12:29)
42+
at log (__tests__/concurrent.test.js:15:11)
4343
4444
console.log
45-
[[test one end]]
45+
END: "one"
4646
47-
at log (__tests__/concurrent.test.js:12:29)
47+
at log (__tests__/concurrent.test.js:15:11)
4848
4949
console.log
50-
[[test nine start]]
50+
START "seven"
5151
52-
at log (__tests__/concurrent.test.js:12:29)
52+
at log (__tests__/concurrent.test.js:15:11)
5353
5454
console.log
55-
[[test six end]]
55+
END: "two"
5656
57-
at log (__tests__/concurrent.test.js:12:29)
57+
at log (__tests__/concurrent.test.js:15:11)
5858
5959
console.log
60-
[[test ten (fails) start]]
60+
START "eight"
6161
62-
at log (__tests__/concurrent.test.js:12:29)
62+
at log (__tests__/concurrent.test.js:15:11)
6363
6464
console.log
65-
[[test eight end]]
65+
END: "four"
6666
67-
at log (__tests__/concurrent.test.js:12:29)
67+
at log (__tests__/concurrent.test.js:15:11)
6868
6969
console.log
70-
[[test nine end]]
70+
START "nine"
7171
72-
at log (__tests__/concurrent.test.js:12:29)
72+
at log (__tests__/concurrent.test.js:15:11)
7373
7474
console.log
75-
[[test five end]]
75+
END: "nine"
7676
77-
at log (__tests__/concurrent.test.js:12:29)
77+
at log (__tests__/concurrent.test.js:15:11)
7878
7979
console.log
80-
[[afterAll]]
80+
START "ten"
8181
82-
at log (__tests__/concurrent.test.js:12:29)
82+
at log (__tests__/concurrent.test.js:15:11)
83+
84+
console.log
85+
END: "five"
86+
87+
at log (__tests__/concurrent.test.js:15:11)
88+
89+
console.log
90+
END: "six"
91+
92+
at log (__tests__/concurrent.test.js:15:11)
93+
94+
console.log
95+
END: "seven"
96+
97+
at log (__tests__/concurrent.test.js:15:11)
98+
99+
console.log
100+
END: "ten"
101+
102+
at log (__tests__/concurrent.test.js:15:11)
103+
104+
console.log
105+
END: "eight"
106+
107+
at log (__tests__/concurrent.test.js:15:11)
108+
109+
console.log
110+
afterAll
111+
112+
at log (__tests__/concurrent.test.js:15:11)
113+
"
114+
`;
115+
116+
exports[`with only runs the tests in the correct order 1`] = `
117+
" console.log
118+
beforeAll
119+
120+
at log (__tests__/concurrent-only.test.js:15:11)
121+
122+
console.log
123+
START "four"
124+
125+
at log (__tests__/concurrent-only.test.js:15:11)
126+
127+
console.log
128+
START "six"
129+
130+
at log (__tests__/concurrent-only.test.js:15:11)
131+
132+
console.log
133+
START "nine"
134+
135+
at log (__tests__/concurrent-only.test.js:15:11)
136+
137+
console.log
138+
END: "nine"
139+
140+
at log (__tests__/concurrent-only.test.js:15:11)
141+
142+
console.log
143+
END: "six"
144+
145+
at log (__tests__/concurrent-only.test.js:15:11)
146+
147+
console.log
148+
END: "four"
149+
150+
at log (__tests__/concurrent-only.test.js:15:11)
151+
152+
console.log
153+
afterAll
154+
155+
at log (__tests__/concurrent-only.test.js:15:11)
156+
"
157+
`;
158+
159+
exports[`with skip runs the tests in the correct order 1`] = `
160+
" console.log
161+
beforeAll
162+
163+
at log (__tests__/concurrent-skip.test.js:15:11)
164+
165+
console.log
166+
START "one"
167+
168+
at log (__tests__/concurrent-skip.test.js:15:11)
169+
170+
console.log
171+
START "two"
172+
173+
at log (__tests__/concurrent-skip.test.js:15:11)
174+
175+
console.log
176+
START "four"
177+
178+
at log (__tests__/concurrent-skip.test.js:15:11)
179+
180+
console.log
181+
START "seven"
182+
183+
at log (__tests__/concurrent-skip.test.js:15:11)
184+
185+
console.log
186+
START "eight"
187+
188+
at log (__tests__/concurrent-skip.test.js:15:11)
189+
190+
console.log
191+
END: "one"
192+
193+
at log (__tests__/concurrent-skip.test.js:15:11)
194+
195+
console.log
196+
START "ten"
197+
198+
at log (__tests__/concurrent-skip.test.js:15:11)
199+
200+
console.log
201+
END: "two"
202+
203+
at log (__tests__/concurrent-skip.test.js:15:11)
204+
205+
console.log
206+
END: "seven"
207+
208+
at log (__tests__/concurrent-skip.test.js:15:11)
209+
210+
console.log
211+
END: "four"
212+
213+
at log (__tests__/concurrent-skip.test.js:15:11)
214+
215+
console.log
216+
END: "eight"
217+
218+
at log (__tests__/concurrent-skip.test.js:15:11)
219+
220+
console.log
221+
END: "ten"
222+
223+
at log (__tests__/concurrent-skip.test.js:15:11)
224+
225+
console.log
226+
afterAll
227+
228+
at log (__tests__/concurrent-skip.test.js:15:11)
83229
"
84230
`;

e2e/__tests__/circusConcurrent.test.ts

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,65 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
7+
import exp = require('constants');
78
import {skipSuiteOnJasmine} from '@jest/test-utils';
89
import runJest, {json as runWithJson} from '../runJest';
910

1011
skipSuiteOnJasmine();
1112

12-
it('runs the correct number of tests', () => {
13-
const {json} = runWithJson('circus-concurrent', ['concurrent.test.js']);
13+
describe('all passing', () => {
14+
it('runs the correct number of tests', () => {
15+
const {json, exitCode} = runWithJson('circus-concurrent', [
16+
'concurrent.test.js',
17+
]);
1418

15-
expect(json.numTotalTests).toBe(10);
16-
expect(json.numPassedTests).toBe(6);
17-
expect(json.numFailedTests).toBe(2);
18-
expect(json.numPendingTests).toBe(2);
19+
expect(exitCode).toBe(0);
20+
expect(json.numTotalTests).toBe(10);
21+
expect(json.numPassedTests).toBe(10);
22+
expect(json.numFailedTests).toBe(0);
23+
expect(json.numPendingTests).toBe(0);
24+
});
25+
26+
it('runs the tests in the correct order', () => {
27+
const {stdout} = runJest('circus-concurrent', ['concurrent.test.js']);
28+
expect(stdout).toMatchSnapshot();
29+
});
1930
});
2031

21-
it('runs the tests in the correct order', () => {
22-
const {stdout} = runJest('circus-concurrent', ['concurrent.test.js']);
23-
expect(stdout).toMatchSnapshot();
32+
describe('with skip', () => {
33+
it('runs the correct number of tests', () => {
34+
const {json, exitCode} = runWithJson('circus-concurrent', [
35+
'concurrent-skip.test.js',
36+
]);
37+
38+
expect(exitCode).toBe(0);
39+
expect(json.numTotalTests).toBe(10);
40+
expect(json.numPassedTests).toBe(6);
41+
expect(json.numFailedTests).toBe(0);
42+
expect(json.numPendingTests).toBe(4);
43+
});
44+
45+
it('runs the tests in the correct order', () => {
46+
const {stdout} = runJest('circus-concurrent', ['concurrent-skip.test.js']);
47+
expect(stdout).toMatchSnapshot();
48+
});
49+
});
50+
51+
describe('with only', () => {
52+
it('runs the correct number of tests', () => {
53+
const {json, exitCode} = runWithJson('circus-concurrent', [
54+
'concurrent-only.test.js',
55+
]);
56+
57+
expect(exitCode).toBe(0);
58+
expect(json.numTotalTests).toBe(10);
59+
expect(json.numPassedTests).toBe(3);
60+
expect(json.numFailedTests).toBe(0);
61+
expect(json.numPendingTests).toBe(7);
62+
});
63+
64+
it('runs the tests in the correct order', () => {
65+
const {stdout} = runJest('circus-concurrent', ['concurrent-only.test.js']);
66+
expect(stdout).toMatchSnapshot();
67+
});
2468
});

0 commit comments

Comments
 (0)