Skip to content

Commit 9d4efd1

Browse files
authored
fix(jest-circus): Send test case results for todo type of tests (#13915)
1 parent 407da29 commit 9d4efd1

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
### Fixes
1111

12+
- `[jest-circus]` Send test case results for `todo` tests ([#13915](https://github.com/facebook/jest/pull/13915))
13+
1214
### Chore & Maintenance
1315

1416
### Performance

e2e/__tests__/__snapshots__/customReportersOnCircus.test.ts.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ exports[`Custom Reporters Integration on jest-circus valid passing assertion cou
99
"onTestCaseResult: adds ok, status: passed, numExpectations: 3
1010
onTestFileResult testCaseResult 0: adds ok, status: passed, numExpectations: 3"
1111
`;
12+
13+
exports[`Custom Reporters Integration on jest-circus push test case results for todo tests 1`] = `
14+
"onTestCaseResult: sample, status: todo, numExpectations: 0
15+
onTestFileResult testCaseResult 0: sample, status: todo, numExpectations: 0"
16+
`;

e2e/__tests__/customReportersOnCircus.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,19 @@ describe('Custom Reporters Integration on jest-circus', () => {
3939

4040
expect(stdout).toMatchSnapshot();
4141
});
42+
43+
test('push test case results for todo tests', () => {
44+
const {stdout} = runJest('custom-reporters', [
45+
'--config',
46+
JSON.stringify({
47+
reporters: [
48+
'default',
49+
'<rootDir>/reporters/AssertionCountsReporter.js',
50+
],
51+
}),
52+
'todo.test.js',
53+
]);
54+
55+
expect(stdout).toMatchSnapshot();
56+
});
4257
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
9+
'use strict';
10+
11+
describe('Custom Reporters', () => {
12+
it.todo('sample');
13+
});

packages/jest-circus/src/testCaseReportHandler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const testCaseReportHandler =
1313
(testPath: string, sendMessageToJest: TestFileEvent) =>
1414
(event: Circus.Event): void => {
1515
switch (event.name) {
16+
case 'test_todo':
1617
case 'test_done': {
1718
const testResult = makeSingleTestResult(event.test);
1819
const testCaseResult = parseSingleTestResult(testResult);

0 commit comments

Comments
 (0)