-
-
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
Missing exit
option in the API documentation, and the NodeJS API
#4388
Comments
@regaldisclaimer When using Mocha programmatically you can terminate your Node process synchronously. Try:
|
@juergba Thanks for your response. Yes I am aware, and have noted in my initial post as such. However, the lack of an equivalent option causes certain scripts to stop working starting version 4. For a script that is only running mocha, your posted code certainly gets the job done. However, for any scripts that need to execute tasks following a test, it does not offer the equivalent effect of having only mocha stop, rather than exiting entirely from the entire script. This notably becomes an issue (as many discussions over this feature were made when the changes were introduced in v4) when one is running servers during tests. The exit flags were often suggested as a way to preserve the behavior prior to v4, which stops the servers after the tests complete. Is there a way for mocha to stop, along with servers started during tests (truly equivalent of pre v4 behavior, or post v4 with the --exit flag) while using Mocha programmatically? |
@regaldisclaimer The
Intentionally using the Re Mocha <v4: I don't know, that's a long time ago. I'm not going to dig this one out. But I doubt there was a way to "exit" when using Mocha programatically. |
There is no way to do this using Mocha programmatically; you have to force-exit yourself once the run has completed. This is how the CLI does it. |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
I commented here initially, but this seems to be an issue to be addressed, not just my inability to locate information.
The
--exit
option introduced in v4 is not incuded in the API documentation, and also seems to be missing from the JS runner.Is this an intentional omission, or should it be added in? If it can be added in, that seems necessary considering how often the usage of this flag is recommended.
Steps to Reproduce
Try to locate the
--exit
option in the API documentation, or try to pass in the option in the JS runner.Expected behavior: Expect to see the option in the API documentation, and have the ability to specify this option in the JS runner
Actual behavior: The flag is only specified on the landing page/"documentation", but is lacking on the API documentation, and is unavailable when using through the NodeJS API/Runner
Reproduces how often: N/A
Versions
Currently using v6.2.0, but the entry is found to be missing on current versions as well
mocha --version
andnode node_modules/.bin/mocha --version
:node --version
:Additional Information
The text was updated successfully, but these errors were encountered: