-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 onRunComplete not triggered when jest runner crashed in watch mode #13187
Comments
After further investigation, the crash occurred even earlier than I originally thought: in createScriptTransformer, right after we dispatched Basically, there is a situation when runner failed due to any runtime/execError within or prior, it will fail to notify reporters. Does anybody know if that was the intended behavior? If not, I think we can capture those exceptions and report back with the Does that make sense? Is there any reason we don't want to do this? |
This issue has prevented us to know that jest run has failed and no results will ever be produced. Since in watch mode, the process will not exit in this situation, our result processing code and reporters will be waiting indefinitely. @SimenB will you consider accepting a PR for this issue? |
Definitely! |
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. |
Version
28.1.3
Steps to reproduce
2. run
yarn install
3. create a simple reporter with
onRunComplete
andonRunStart
methods if you are not usingvscode-jest
extension invscode
4. run jest command: with the custom reporter. For example, with the
vscode-jest
extension:yarn test --watchAll --no-coverage --reporters default --reporters "/your-vscode-extension-path/vscode-jest/out/reporter.js"
you should see something like this:
The
onRunComplete
, which should output "onRunComplete", is never invoked.Expected behavior
the reporter should receive
onRunComplete
callback with at least testResult.testExecError populated.Actual behavior
reporter
onRunComplete
was never called.Additional context
We discovered this issue during the investigation of jest-community/vscode-jest#894. The culprit seems to be in TestScheduler where it catches runner exception and rethrow if it's in watch mode and not interrupted.
It didn't seem right as this resulted in reporters not knowing what is happening: it received the
onRunStart
but nothing else afterward. It is also inconsistent that other watch mode runs that are always reported with (onRunStart
,onRunComplete
) pair. It seems we could capture this error inTestResult.testExecError
and report it viaonRunComplete
.I could write a PR if you agree with the fix.
Environment
The text was updated successfully, but these errors were encountered: