jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: Reporter.onTestCaseResult not called for test.todo in Jest 27

Open segrey opened this issue 4 years ago • 6 comments

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

segrey avatar Dec 22 '21 20:12 segrey

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.

segrey avatar Dec 22 '21 20:12 segrey

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.

github-actions[bot] avatar Dec 22 '22 20:12 github-actions[bot]

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.

github-actions[bot] avatar Jan 21 '23 20:01 github-actions[bot]

This seems reasonable to fix.

SimenB avatar Jan 23 '23 12:01 SimenB

@SimenB I'd like to work on this..

SheshankM avatar Jan 27 '23 04:01 SheshankM

Go for it 👍

SimenB avatar Jan 27 '23 17:01 SimenB

@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..

SheshankM avatar Jan 27 '23 19:01 SheshankM

@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..

SheshankM avatar Jan 28 '23 08:01 SheshankM

https://github.com/facebook/jest/releases/tag/v29.5.0

SimenB avatar Mar 06 '23 13:03 SimenB

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.

github-actions[bot] avatar Apr 06 '23 00:04 github-actions[bot]