Skip to content
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

Add --expose-internals to bin/mocha's allowed Node flags #3045

Closed
ScottFreeCode opened this issue Oct 3, 2017 · 10 comments
Closed

Add --expose-internals to bin/mocha's allowed Node flags #3045

ScottFreeCode opened this issue Oct 3, 2017 · 10 comments
Labels
semver-minor implementation requires increase of "minor" version number; "features" type: chore generally involving deps, tooling, configuration, etc.

Comments

@ScottFreeCode
Copy link
Contributor

ScottFreeCode commented Oct 3, 2017

Allow tools such as why-is-node-running to be used with Mocha calling mocha --expose-internals instead of node --expose-internals node_modules/mocha/bin/_mocha. Helps with #3044

@ScottFreeCode ScottFreeCode added type: chore generally involving deps, tooling, configuration, etc. status: accepting prs Mocha can use your help with this one! semver-minor implementation requires increase of "minor" version number; "features" labels Oct 3, 2017
@ScottFreeCode ScottFreeCode changed the title Add --expose-internals to bin/mocha's Node flags Add --expose-internals to bin/mocha's allowed Node flags Oct 3, 2017
@boneskull
Copy link
Member

There's no precedent for passing flags through for userland modules, though I could be mistaken.

@boneskull
Copy link
Member

Allow tools such as why-is-node-running

This is the only tool that wants the flag

@boneskull
Copy link
Member

Also, why-is-node-running is unmaintained and relies on Node.js internals which don't necessarily exist (internals/linked-list?). I'm loathe to offer explicit support for it--and indeed, I can't get it to give me much useful information. Async hooks, async wrap, or just a debugger are likely more useful.

@boneskull boneskull added status: waiting for author waiting on response from OP - more information needed and removed status: accepting prs Mocha can use your help with this one! labels Oct 4, 2017
@boneskull
Copy link
Member

boneskull commented Oct 4, 2017

I'd like to hold up on requesting a PR until there's some agreement about how to proceed.

Ultimately, teaching developers how to use debuggers or async_hooks is not really the best use of our resources. We can point them in the general direction of how to solve this, but a good portion of them may be better off simply adding the --exit flag.

@ScottFreeCode
Copy link
Contributor Author

--expose-internals is actually a(n undocumented) Node flag that why-is-node-running just happens to need since it uses the Node components affected by said flag, so while the immediate cause for wanting Mocha to pass it on is making why-is-node-running easier to use, ultimately it would also be useful for anyone wanting to test a library that requires --expose-internals. Um... if there are any. Not exactly a strong use case there I suppose; just want to be clear that it is a Node thing and not just a why-is-node-running thing.

Can't disagree on the value, or rather lack thereof, of why-is-node-running; sounds like a great module, hasn't held up to even a few days of scrutiny... Let's see how async hooks works out before we go any further out of our way to make why-is-node-running easier.

@boneskull
Copy link
Member

Ah, my bad, I didn't know that was a real flag. 😛

@boneskull
Copy link
Member

anyway, agreed; I'm happy to sit on this for a bit to see how it goes. here are the docs I've added for reference

@boneskull boneskull removed the status: waiting for author waiting on response from OP - more information needed label Oct 4, 2017
@mceachen
Copy link

mceachen commented Oct 5, 2017

@boneskull thanks for taking the time to write those docs!

@milsosa
Copy link

milsosa commented Oct 12, 2017

I built this useful snippet to run the mocha tests programmatically and uses why-is-node-running to figure out why the process keeps running.

@juergba
Copy link
Member

juergba commented Dec 24, 2019

outdated.
Mocha uses package node-environment-flags or process.allowedNodeEnvironmentFlags to determine Node flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor implementation requires increase of "minor" version number; "features" type: chore generally involving deps, tooling, configuration, etc.
Projects
None yet
Development

No branches or pull requests

5 participants