-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
dispose Mocha Runner after use to avoid MaxlistenersExceededWarning #41403
Conversation
- removed manual `unhandledRejection` listener as Mocha v8.2.0 now has one
The PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
I've got a DefinitelyTyped PR over at DefinitelyTyped/DefinitelyTyped#49382 if you'd like to take a look so we can get rid of the |
@DanielRosenwasser not sure if you're asking me to review the typings. if it works for you, it works for me... I haven't figured out how to consume them when working in Mocha itself |
but happy to update this PR when those changes land |
|
I've updated the PR, let's see if it works. |
@amcasey are the build failures just a matter of updating the lockfile? |
@DanielRosenwasser I think I'm missing a step. Was Edit: I wasn't building the tests locally... |
Okay, I'm finally caught up. Yes, this PR branch is using |
Thanks @boneskull! |
This change eliminates the frequent
MaxListenersExceededWarning
s emitted when runninggulp runtests-parallel
. The Runner#dispose method removes all EE listeners theRunner
instance created. When using theRunner
manually like this, you'll want to call this function. It is a relatively new, and the Mocha typings have not been updated to reflect its presence (hence the@ts-ignore
).Apologies, I could not find an issue here associated with this change, but I'm sure there is one somewhere. I'll leave this as a draft until I find it.Created #41404.Fixes #41404, mochajs/mocha#4329 reported by @weswigham
Commit summary:
runner.dispose()
on listener forend
eventunhandledRejection
listener as Mocha v8.2.0 now has one