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
There's no precedent for passing flags through for userland modules, though I could be mistaken.
Allow tools such as why-is-node-running
This is the only tool that wants the flag
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.
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.
--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.
Ah, my bad, I didn't know that was a real flag. 馃槢
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 thanks for taking the time to write those docs!
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.
outdated.
Mocha uses package node-environment-flags or process.allowedNodeEnvironmentFlags to determine Node flags.
Most helpful comment
I built this useful snippet to run the mocha tests programmatically and uses
why-is-node-runningto figure out why the process keeps running.