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

Consider using flagged-respawn #2517

Closed
ScottFreeCode opened this issue Oct 5, 2016 · 3 comments
Closed

Consider using flagged-respawn #2517

ScottFreeCode opened this issue Oct 5, 2016 · 3 comments
Labels
type: feature enhancement proposal

Comments

@ScottFreeCode
Copy link
Contributor

From bin/mocha:

/**
 * This tiny wrapper file checks for known node flags and appends them
 * when found, before invoking the "real" _mocha(1) executable.
 */

It appears likely that we could merge bin/_mocha into this file (and probably simplify the code currently in bin/mocha) using https://www.npmjs.com/package/flagged-respawn

May need to consider whether removing the direct _mocha executable would be a breaking change.

@ScottFreeCode ScottFreeCode changed the title Consider use of flagged-respawn Consider using flagged-respawn Oct 5, 2016
@boneskull boneskull added the type: feature enhancement proposal label Oct 5, 2016
@boneskull
Copy link
Contributor

May need to consider whether removing the direct _mocha executable would be a breaking change.

Fully removing it would be a breaking change--tools like Istanbul depend on it--but if it was just an alias, it might not necessitate a major:

// _mocha
require('./mocha');

Needs more investigation.

@ScottFreeCode
Copy link
Contributor Author

As a potential alternative, I hear you can now npx -n --use_strict mocha, which starts to sound not too bad compared to node_modules/.bin/mocha --use_strict or even mocha --use_strict -- it's far better than node --use_strict node_modules/mocha/bin/mocha at least. Plus if we relied on that instead of Mocha respawning itself, we wouldn't have to update as Node flags are added. But there's old-Node compatibility to consider: zkat/npx#30 And, perhaps most critically, I don't think you could put Node flags (of which at least --use_strict is useful... perhaps so useful there's some other config method that could activate it?...) into mocha.opts that way.

@juergba
Copy link
Contributor

juergba commented Sep 2, 2019

Since v6.2.0 we are aiming to avoid child-processes and do respawn only when Node flags are used or the esm module is required.

Node flags are detected by process.allowedNodeEnvironmentFlags or its polyfil node-environment-flags.

@juergba juergba closed this as completed Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

3 participants