Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
segrey opened this issue Dec 22, 2021 · 10 comments · Fixed by #13915
Closed

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

segrey opened this issue Dec 22, 2021 · 10 comments · Fixed by #13915

Comments

@segrey
Copy link

segrey commented Dec 22, 2021

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
Copy link
Author

segrey commented Dec 22, 2021

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.

@github-actions
Copy link

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 github-actions bot added the Stale label Dec 22, 2022
@github-actions
Copy link

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 github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2023
@SimenB SimenB reopened this Jan 23, 2023
@SimenB
Copy link
Member

SimenB commented Jan 23, 2023

This seems reasonable to fix.

@SheshankM
Copy link

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

@SimenB
Copy link
Member

SimenB commented Jan 27, 2023

Go for it 👍

@SheshankM
Copy link

@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
Copy link

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

@SimenB
Copy link
Member

SimenB commented Mar 6, 2023

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

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

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 github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants