[Bug]: Reporter.onTestCaseResult not called for test.todo in Jest 27
Version
27.4.5
Steps to reproduce
Reporter.onTestCaseResult doesn't get called on test.todo.
// my.test.js
test.todo('my todo');
test('my test', () => {});
// my-reporter.js
class MyReporter {
onTestCaseResult(test, testCaseResult) {
console.log('onTestCaseResult: ' + testCaseResult.title);
}
}
module.exports = MyReporter;
Expected behavior
jest --reporters ./my-reporter.js should print:
Determining test suites to run...onTestCaseResult: my test
onTestCaseResult: my todo
Actual behavior
Actually, jest --reporters ./my-reporter.js prints:
Determining test suites to run...onTestCaseResult: my test
Additional context
No response
Environment
System:
OS: Linux 5.4 Linux Mint 20.2 (Uma)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
npmPackages:
jest: ^27.4.5 => 27.4.5
This caused https://youtrack.jetbrains.com/issue/WEB-51467. A workaround will be added in WebStorm 2021.3.2: test.todo will be fetched from onTestFileResult events, but it happens too late, when the whole test file is done. Would be great to fix this issue, i.e. fire onTestCaseResult events for test.todo.
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This seems reasonable to fix.
@SimenB I'd like to work on this..
Go for it 👍
@SimenB could you please help me here how will i be able to call onTestCaseResult event for test.todo , although I found that by running " jest --reporters ./my-reporter.js --runTestsByPath [path/to/file.js] " this command all the test in the file would run including test.todo and onTestCaseResult , I would be elated to know if there is another way we can solve this..
@SimenB could you please help me here how will i be able to call onTestCaseResult event for test.todo , although I found that by running " jest --reporters ./my-reporter.js --runTestsByPath [path/to/file.js] " this command would run all the tests in the file including test.todo and onTestCaseResult , I would be elated to know if there is another way we can solve this..
https://github.com/facebook/jest/releases/tag/v29.5.0
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.