-
Notifications
You must be signed in to change notification settings - Fork 22
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
mocha crashes with no method 'getWindowSize' (on process.stdout or tty) #4
Comments
This is caused by having more than one mocha floating around. Normally, base.js is loaded early enough to not be affected by all the monkey patching (https://github.com/glenjamin/mocha-multi/blob/master/mocha-multi.js#L6) For some reason, your custom reportering (this one? https://github.com/sjonnet19/mocha-cobertura-reporter) declare mocha as a "dependency", when it should really be a "peerDependency". This causes a second base.js to be loaded - which only happens after the tty stuff has fired. The simplest fix would be to add Unfortunately mocha has quite a bit of hidden state, so there's not a huge amount I can do here. |
Thanks for the explanation and easy fix, Glen. I suspect my fix above does not work correctly - and one of my reporters is using the additional base.js and not writing the output via mocha-multi. I'm using a few different mocha reporters, and none of them declare the dependency correctly. Boo. |
…ogether with mocha-multi; see glenjamin/mocha-multi#4
So mocha-junit-reporter can be used with mocha-multi. See: glenjamin/mocha-multi#4
I upgraded to the latest package versions in my project and started to get this error when using mocha-multi.
I suspect it may be because of how mocha-multi fakes the stdout/tty.
Here is my fix. It is not particularly nice, but perhaps it helps someone. I add
mocha --require ./fix-mocha.js --reporter mocha-multi ...
fix-mocha.js
If case you're curious, tty has these properties:
and the isatty returns
It seems related to mochajs/mocha#36 - but that is such an old issue I wonder why it resurfaced.
Stack trace:
The text was updated successfully, but these errors were encountered: