Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
What happened to --no-exit option? #3475
It seems that the
Steps to Reproduce
Expected behavior: Mocha runs tests with the no exit (default) behavior.
Actual behavior: Error that there is no
Reproduces how often: 100%
The reason I noticed it is because I wanted to be able to execute a test that had the same behavior on 2.x and 5.x in this regard, so wanted to just use
I believe the change is this commit.
BTW if you want to v5.x behave like v2.x, use
I want the opposite: 3.x to behave like 5.x . The system I have could have either installed and I would have liked to just call
I have to resort to version sniffing mocha now.
He wants the opposite, @outsideris... -- version parity.
@dougwilson, you could patch your 5.0 installation if you're comfortable doing so.
Find these lines in "bin/_mocha" of your Mocha installation.
.option('--no-exit', 'require a clean shutdown of the event loop: mocha will not call process.exit')
You should be good to go afterwards.
Hi, sorry I forgot to follow up here. The patch did work. I ended up just removing the usage of the flag from my tests. The context is that many employees will run a test suite. The suite runs on various different versions of mocha for reasons I don't have control over. I wanted to get them to have the no exit behavior across the board, but if I include the flag most people cannot run them (as most use the current version of mocha) since it throws an error.
The only time it really comes into play is when a human edits the tests, as that is when a non exit behavior may be introduced. For old mochas those devs won't catch it until CI since the flag is not there.
I figured it was strange the docs seemed like it should work so opened an issue.
I hope that makes sense and look forward to the release you mentioned :)