-
-
Notifications
You must be signed in to change notification settings - Fork 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
Node 12 process.removeListener is not a function #3895
Comments
Node documentation link should be to this. Does this occur with the built-in reporters, or just your custom one? |
Thank you @plroebuck for the documentation link and the follow up question. I suspect the problem will happen with any project that uses Mocha and attempts to run it with Node 12. My reporter does not have any dependencies, just devDependencies: The error occurs not when running my reporter in another project, but trying to run unit tests I've written using Mocha. The error occurs after all 105 of my unit test successfully run and pass. 🤷♂ sorry I'm not very knowledgeable about all this 😅 |
@whyboris is this still a pending issue? |
Have you updated your Node version? Which version do you use now? |
I'm on Node |
I'm also seeing exactly the same issue with mocha tests in node |
I just tried to recreate this without success:
Mocha's unit tests are also all run on node 12: https://travis-ci.org/mochajs/mocha/builds/606685504 It doesn't seem to be a problem with the base package, or any of the built-in reporters that are currently being tested. |
I can recreate the error by cloning
|
Since we test on node 12 it seems that this code path must be untested. First order of business would be to recreate the bug in a test in a Pull-request we can the iterate on to fix it |
I haven't understood what happens exactly. I just have some remarks:
I'm not very experienced in mocking, but I'm shyly passing the ball back to you. |
@rgroothuijsen thank you for your confirmation. 👍 |
I had this issue with version
I updated to
It's not clear what the error is, but at least it points to a file in my repository, rather than to mocha Please feel free to close the issue if you think you've resolved it 👌 |
@whyboris I'm closing this issue. |
I recently encountered this error when upgrading Node through v12, and in case anyone else is having trouble with it... It may relate to the change in v12 of making global.process non-enumerable, so some mocking/injection frameworks when asked to stub In my case the framework was If that doesn't apply in your case, then the following may at least ease the symptoms if not address the root cause:
Adding |
@john-perks thank you. This issue and its reproduction repository are requiring |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Running unit tests with
"mocha": "6.1.4",
on my repository along withNode v12.0.0
results in errorprocess.removeListener is not a function
This error does not occur with
Node v10.15.1
Steps to Reproduce
I suspect the error will occur any time you run unit tests with mocha along with Node 12, but here's a way:
Clone my repository:
git clone https://github.com/whyboris/karma-helpful-reporter.git
Install Node v12.0.0 (I'm using
nvm
to switch back between versions easily)Then
npm run test
and see the error.Note that the error does not occur on Node v10.
Expected behavior: [What you expect to happen]
No error with
Node 12
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
Every time
Versions
"mocha": "6.1.4",
Node v12.0.0
mocha --version
andnode node_modules/.bin/mocha --version
:6.1.4
node --version
:v12.0.0
Additional Information
Full log:
Node documentation for
removeListener
:https://nodejs.org/api/events.html#events_event_removelistener
[edit] - documentation should be here, thank you @plroebuck :
https://nodejs.org/api/events.html#events_emitter_removelistener_eventname_listener
The text was updated successfully, but these errors were encountered: