Skip to content

Commit

Permalink
fix(jest-circus): Send test case results for todo type of tests (#13915)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshitsinha authored Feb 23, 2023
1 parent 407da29 commit 9d4efd1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

### Fixes

- `[jest-circus]` Send test case results for `todo` tests ([#13915](https://github.com/facebook/jest/pull/13915))

### Chore & Maintenance

### Performance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ exports[`Custom Reporters Integration on jest-circus valid passing assertion cou
"onTestCaseResult: adds ok, status: passed, numExpectations: 3
onTestFileResult testCaseResult 0: adds ok, status: passed, numExpectations: 3"
`;

exports[`Custom Reporters Integration on jest-circus push test case results for todo tests 1`] = `
"onTestCaseResult: sample, status: todo, numExpectations: 0
onTestFileResult testCaseResult 0: sample, status: todo, numExpectations: 0"
`;
15 changes: 15 additions & 0 deletions e2e/__tests__/customReportersOnCircus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,19 @@ describe('Custom Reporters Integration on jest-circus', () => {

expect(stdout).toMatchSnapshot();
});

test('push test case results for todo tests', () => {
const {stdout} = runJest('custom-reporters', [
'--config',
JSON.stringify({
reporters: [
'default',
'<rootDir>/reporters/AssertionCountsReporter.js',
],
}),
'todo.test.js',
]);

expect(stdout).toMatchSnapshot();
});
});
13 changes: 13 additions & 0 deletions e2e/custom-reporters/__tests__/todo.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

'use strict';

describe('Custom Reporters', () => {
it.todo('sample');
});
1 change: 1 addition & 0 deletions packages/jest-circus/src/testCaseReportHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const testCaseReportHandler =
(testPath: string, sendMessageToJest: TestFileEvent) =>
(event: Circus.Event): void => {
switch (event.name) {
case 'test_todo':
case 'test_done': {
const testResult = makeSingleTestResult(event.test);
const testCaseResult = parseSingleTestResult(testResult);
Expand Down

0 comments on commit 9d4efd1

Please sign in to comment.