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

fix: race condition between the Karma shutdown and coverage writing #463

Merged
merged 2 commits into from
Feb 5, 2022

Commits on Jan 19, 2022

  1. fix: race condition between the Karma shutdown and coverage writing

    The creation of parent directories is asynchronous process, which was not properly awaited, which resulted in the coverage reports not being written to the disk sometimes as Karma process has exited before the reporter completed the writing of the coverage report.
    
    Also update the test case to use async implementation of the corresponding stub to prevent regressions in the future. Remove manual calls for `done` parameter in tests as it is handled by the stub now.
    
    Fixes karma-runner#434
    devoto13 committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    d970028 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2022

  1. fix: handle unexpected error when generating code coverage

    The issue surfaced itself after d970028. The EEXIST error from concurrent attempts to create the same directory were previously silently swallowed, but started to show up once the call was properly synchronized.
    
    The EEXIST will now result in `promiseComplete` being rejected and reported as `unhandledRejection` because it is awaited in the `onExit` callback. The unhandled rejection is then picked up by `karma` [here](https://github.com/karma-runner/karma/blob/c985155a4eac95c525e1217e98d4013ac5f53305/lib/server.js#L395) triggering [the close logic](https://github.com/karma-runner/karma/blob/c985155a4eac95c525e1217e98d4013ac5f53305/lib/server.js#L392) which (among other things) will trigger `onExit` callback causing an infinite loop.
    
    The local fix is to handle the rejected promise directly and report failure to karma by passing a non-zero exit code.
    devoto13 committed Jan 21, 2022
    Configuration menu
    Copy the full SHA
    c823801 View commit details
    Browse the repository at this point in the history