Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Uncaught exception: emitting a 'test end' event for a hook #224

Open
juergba opened this issue Apr 24, 2020 · 1 comment
Open

Uncaught exception: emitting a 'test end' event for a hook #224

juergba opened this issue Apr 24, 2020 · 1 comment

Comments

@juergba
Copy link

juergba commented Apr 24, 2020

Description

Emitting a 'test end' event for a hook is incorrect and leads to an uncaught exception with Mocha >= 7.1.0. A 'hook end' event should be fired instead.

see src/adapter.js

related Mocha issue

@boneskull
Copy link
Contributor

For anyone who finds this issue: Mocha published a workaround for this in v7.1.2.

Depending on what versions of Mocha you intend to support, v6.0.0 of Mocha and newer should allow you pull out these variables instead of hardcoding event names:

// etc
const {EVENT_TEST_END, EVENT_HOOK_END} = require('mocha').Runner.constants;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants