🔧 Stop hardcoding mocha internals in test-cover - #47
Merged
Merged
Conversation
Refs #46 At the moment, `test-cover` invokes `nyc` and `mocha` by their paths inside `node_modules`, reaching past each package's published binary to a file it merely happens to ship — in `mocha`'s case the private `bin/_mocha`. `mocha@12` deletes that file, so the open bump to it fails CI with `spawn node_modules/mocha/bin/_mocha ENOENT` before a single test runs. npm puts `node_modules/.bin` on `PATH` for scripts, so this change calls both binaries by name, as the neighbouring `test` script already does. `bin/_mocha` existed to run in-process, which is what lets `nyc` see the coverage — but `mocha`'s public binary only forks when node flags are passed, and we pass none, so the generated `lcov.info` is byte-identical. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #46
At the moment,
test-coverinvokesnycandmochaby their paths insidenode_modules, reaching past each package's published binary to a file it merely happens to ship — inmocha's case the privatebin/_mocha.mocha@12deletes that file, so the open bump to it fails CI withspawn node_modules/mocha/bin/_mocha ENOENTbefore a single test runs.npm puts
node_modules/.binonPATHfor scripts, so this change calls both binaries by name, as the neighbouringtestscript already does.bin/_mochaexisted to run in-process, which is what letsnycsee the coverage — butmocha's public binary only forks when node flags are passed, and we pass none, so the generatedlcov.infois byte-identical.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com