Wrong node binary picked up to process tests
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
* **Version**: 7.2.0
* **Platform**: linux x86_64
When running `c8` with `mocha` for example, as such: `node node_modules/c8/bin/c8 node_modules/mocha/bin/mocha test.js`, it is not guaranty that the same node binary will be used to process c8 and mocha (and therefore the test), is this intended?
This is coming from this piece of code: https://github.com/bcoe/c8/blob/master/lib/parse-args.js#L131
```js
if (argv[0][0] === '-') {
argv.unshift(process.execPath)
}
```
The node executable is only added if the first argument not parsed is an option. Why not doing it all the time?
In my case, I am using various node versions for my unit tests. And it might pick up the version in /usr/bin unless specially specified like this: `node node_modules/c8/bin/c8 node node_modules/mocha/bin/mocha test.js`
To me, this seems redundant and not intuitive. The current behavior might lead to unexpected issues that might be hard to spot.
Contributor guide
Assessment
This issue has not been assessed yet.