Skip to content

Commit e3812ae

Browse files
eyalrothcpojer
andauthored
#15759 Fix it.concurrent not working with describe.skip (#15765)
Co-authored-by: Christoph Nakazawa <[email protected]> Co-authored-by: Christoph Nakazawa <[email protected]>
1 parent d9f5e68 commit e3812ae

File tree

4 files changed

+144
-4
lines changed

4 files changed

+144
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## main
22

3-
43
### Features
54

65
- `[jest-runtime]` Reduce redundant ReferenceError messages
76
- `[jest-core]` Include test modules that failed to load when --onlyFailures is active
87

98
### Fixes
109

10+
- `[jest-circus]` Fix `it.concurrent` not working with `describe.skip` ([#15765](https://github.com/jestjs/jest/pull/15765))
1111
- `[jest-snapshot]` Fix mangled inline snapshot updates when used with Prettier 3 and CRLF line endings
1212
- `[jest-runtime]` Importing from `@jest/globals` in more than one file no longer breaks relative paths ([#15772](https://github.com/jestjs/jest/issues/15772))
1313

packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.ts.snap

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,54 @@ run_finish
7272
unhandledErrors: 0"
7373
`;
7474

75+
exports[`describe.skip + concurrent 1`] = `
76+
"start_describe_definition: describe
77+
add_hook: beforeEach
78+
add_hook: afterEach
79+
add_test: one
80+
add_test: two
81+
add_test: three
82+
finish_describe_definition: describe
83+
run_start
84+
run_describe_start: ROOT_DESCRIBE_BLOCK
85+
run_describe_start: describe
86+
test_start: one
87+
test_start: two
88+
test_start: three
89+
test_skip
90+
test_skip
91+
test_skip
92+
run_describe_finish: describe
93+
run_describe_finish: ROOT_DESCRIBE_BLOCK
94+
run_finish
95+
96+
unhandledErrors: 0"
97+
`;
98+
99+
exports[`describe.skip + concurrent.each 1`] = `
100+
"start_describe_definition: describe
101+
add_hook: beforeEach
102+
add_hook: afterEach
103+
add_test: one
104+
add_test: two
105+
add_test: three
106+
finish_describe_definition: describe
107+
run_start
108+
run_describe_start: ROOT_DESCRIBE_BLOCK
109+
run_describe_start: describe
110+
test_start: one
111+
test_start: two
112+
test_start: three
113+
test_skip
114+
test_skip
115+
test_skip
116+
run_describe_finish: describe
117+
run_describe_finish: ROOT_DESCRIBE_BLOCK
118+
run_finish
119+
120+
unhandledErrors: 0"
121+
`;
122+
75123
exports[`failures 1`] = `
76124
"start_describe_definition: describe
77125
add_hook: beforeEach
@@ -126,6 +174,32 @@ run_finish
126174
unhandledErrors: 0"
127175
`;
128176

177+
exports[`nested describe.skip + concurrent 1`] = `
178+
"start_describe_definition: describe
179+
start_describe_definition: nested
180+
add_test: one
181+
add_test: two
182+
add_test: three
183+
finish_describe_definition: nested
184+
finish_describe_definition: describe
185+
run_start
186+
run_describe_start: ROOT_DESCRIBE_BLOCK
187+
run_describe_start: describe
188+
test_start: one
189+
test_start: two
190+
test_start: three
191+
run_describe_start: nested
192+
test_skip
193+
test_skip
194+
test_skip
195+
run_describe_finish: nested
196+
run_describe_finish: describe
197+
run_describe_finish: ROOT_DESCRIBE_BLOCK
198+
run_finish
199+
200+
unhandledErrors: 0"
201+
`;
202+
129203
exports[`simple test 1`] = `
130204
"start_describe_definition: describe
131205
add_hook: beforeEach

packages/jest-circus/src/__tests__/baseTest.test.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,72 @@ test('concurrent.each', () => {
8383

8484
expect(stdout).toMatchSnapshot();
8585
});
86+
87+
test('describe.skip + concurrent', () => {
88+
const {stdout} = runTest(`
89+
describe.skip('describe', () => {
90+
beforeEach(() => {});
91+
afterEach(() => { throw new Error('banana')});
92+
test.concurrent('one', () => {
93+
console.log('hello one');
94+
throw new Error('kentucky')
95+
});
96+
test.concurrent('two', () => {
97+
console.log('hello two');
98+
});
99+
test.concurrent('three', async () => {
100+
console.log('hello three');
101+
await Promise.resolve();
102+
});
103+
})
104+
`);
105+
106+
expect(stdout).not.toEqual(expect.stringContaining('hello'));
107+
108+
expect(stdout).toMatchSnapshot();
109+
});
110+
111+
test('describe.skip + concurrent.each', () => {
112+
const {stdout} = runTest(`
113+
describe.skip('describe', () => {
114+
beforeEach(() => {});
115+
afterEach(() => { throw new Error('banana')});
116+
test.concurrent.each([
117+
['one'],
118+
['two'],
119+
['three'],
120+
])('%s', async (name) => {
121+
console.log('hello %s', name);
122+
await Promise.resolve();
123+
});
124+
})
125+
`);
126+
127+
expect(stdout).not.toEqual(expect.stringContaining('hello'));
128+
129+
expect(stdout).toMatchSnapshot();
130+
});
131+
132+
test('nested describe.skip + concurrent', () => {
133+
const {stdout} = runTest(`
134+
describe('describe', () => {
135+
describe.skip('nested', () => {
136+
test.concurrent('one', () => {
137+
console.log('hello one');
138+
throw new Error('kentucky')
139+
});
140+
test.concurrent('two', () => {
141+
console.log('hello two');
142+
});
143+
test.concurrent('three', async () => {
144+
console.log('hello three');
145+
await Promise.resolve();
146+
});
147+
})
148+
})
149+
`);
150+
151+
expect(stdout).not.toEqual(expect.stringContaining('hello'));
152+
153+
expect(stdout).toMatchSnapshot();
154+
});

packages/jest-circus/src/run.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ const _runTestsForDescribeBlock = async (
169169
function collectConcurrentTests(
170170
describeBlock: Circus.DescribeBlock,
171171
): Array<ConcurrentTestEntry> {
172-
if (describeBlock.mode === 'skip') {
173-
return [];
174-
}
175172
return describeBlock.children.flatMap(child => {
176173
switch (child.type) {
177174
case 'describeBlock':

0 commit comments

Comments
 (0)