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: karma-mocha hangs when there's an exception in a hook #4251

Merged
merged 1 commit into from
Apr 24, 2020

Conversation

juergba
Copy link
Contributor

@juergba juergba commented Apr 24, 2020

Description

If an exception/assert error occurs in a hook, karma-mocha stops immediately due to an unhandled exception.
[...]
karma-mocha is passing a hook object as the param with a 'test end' event.
[...]
The hook doesn't have a retriedTest method, so it throws "Uncaught TypeError: test.retriedTest is not a function"

Description of the Change

Emitting a test end event for a hook is wrong. We add a type check before calling retriedTest() in order to prevent an uncaught exception.

Applicable issues

closes #4250
closes #4227

@juergba juergba requested a review from a team April 24, 2020 12:51
@juergba juergba self-assigned this Apr 24, 2020
@juergba juergba added type: bug a defect, confirmed by a maintainer area: integrations related to working with 3rd party software (e.g., babel, typescript) semver-patch implementation requires increase of "patch" version number; "bug fixes" labels Apr 24, 2020
@juergba juergba added this to the next milestone Apr 24, 2020
@coveralls
Copy link

Coverage Status

Coverage remained the same at 93.06% when pulling 7045e73 on juergba/karma into 6838eaf on master.

Copy link
Contributor

@craigtaub craigtaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Netlify "429" error code not related + already known. LGTM.

@juergba juergba added block and removed block labels Apr 24, 2020
@boneskull
Copy link
Contributor

lgtm, but needs a test. I can add one

@boneskull boneskull merged commit 13e94b1 into master Apr 24, 2020
boneskull added a commit that referenced this pull request Apr 24, 2020
Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
@juergba juergba deleted the juergba/karma branch April 25, 2020 16:07
@juergba juergba changed the title Fix: karma-mocha hangs when there's a exception in a hook Fix: karma-mocha hangs when there's an exception in a hook Apr 25, 2020
@juergba juergba added the landed-on-v7.1.x cherry-picked from master label Apr 26, 2020
lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this pull request Jul 3, 2020
Updated version contains the fix for karma-mocha runner:
mochajs/mocha#4251

Change-Id: Ifd69fb63017a539558571e3dabf3508fe4a395c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: integrations related to working with 3rd party software (e.g., babel, typescript) landed-on-v7.1.x cherry-picked from master semver-patch implementation requires increase of "patch" version number; "bug fixes" type: bug a defect, confirmed by a maintainer
Projects
None yet
4 participants