Skip to content

🔧 Stop hardcoding mocha internals in test-cover - #47

Merged
alecgibson merged 1 commit into
mainfrom
test-cover-bin-shims
Sep 9, 2026
Merged

alecgibson merged 1 commit into
mainfrom
test-cover-bin-shims

Conversation

@alecgibson

Copy link
Copy Markdown
Contributor

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

Co-Authored-By: Claude noreply@anthropic.com

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>
@alecgibson
alecgibson marked this pull request as ready for review September 9, 2026 07:19
@alecgibson
alecgibson merged commit 6cda775 into main Sep 9, 2026
8 checks passed
@alecgibson
alecgibson deleted the test-cover-bin-shims branch September 9, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant