nyc: `nyc` + `esm` is broken in latest NodeJS versions
nyc is not reporting code coverage results after possibly related nodejs change https://github.com/nodejs/node/commit/15bced0bde
Link to bug demonstration repository
https://github.com/jeremymeng/nyc-repro
install package then run npm run cc
Expected Behavior
(same as in nodejs 18.17.0)
basic test
✓ add correctly
1 passing (4ms)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
index.js | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
Observed Behavior
a warning followed by passing test but 0% coverage
Transformation error for /home/meng/git/nyc-repro/src/index.js ; return original code
The "mod" argument must be an instance of Module. Received an instance of Module
basic test
✓ add correctly
1 passing (3ms)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Troubleshooting steps
- still occurring when I put
cache: false
in my nyc config
I added a rimraf
command to remve the cache directory
Environment Information
System:
OS: Linux 6.4 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Memory: 23.40 GB / 31.11 GB
Binaries:
Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.17.1/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
npmPackages:
nyc: ^15.1.0 => 15.1.0
About this issue
- Original URL
- State: open
- Created 10 months ago
- Reactions: 4
- Comments: 17
Commits related to this issue
- [test] disable code coverage temporarily Latest NodeJS versions broke nyc. This PR disables it temporarily. https://github.com/istanbuljs/nyc/issues/1530 An workitem is logged to track re-enabling ... — committed to jeremymeng/azure-sdk-for-js by jeremymeng 10 months ago
- [test] disable code coverage temporarily (#27129) Latest NodeJS versions broke nyc. This PR disables it temporarily. https://github.com/istanbuljs/nyc/issues/1530 An workitem is logged to track... — committed to Azure/azure-sdk-for-js by jeremymeng 10 months ago
- [engsys] replace dev dependency `nyc` with `c8` ***NO_CI*** The combination of `nyc` + `esm` is broken in latest versions of NodeJS (https://github.com/istanbuljs/nyc/issues/1530#issuecomment-177340... — committed to Azure/azure-sdk-for-js by jeremymeng 8 months ago
- [engsys] replace dev dependency `nyc` with `c8` ***NO_CI*** The combination of `nyc` + `esm` is broken in latest versions of NodeJS (https://github.com/istanbuljs/nyc/issues/1530#issuecomment-177340... — committed to Azure/azure-sdk-for-js by jeremymeng 8 months ago
- [engsys] replace dev dependency `nyc` with `c8` ***NO_CI*** The combination of `nyc` + `esm` is broken in latest versions of NodeJS (https://github.com/istanbuljs/nyc/issues/1530#issuecomment-177340... — committed to Azure/azure-sdk-for-js by jeremymeng 8 months ago
- [engsys] replace dev dependency `nyc` with `c8` ***NO_CI*** The combination of `nyc` + `esm` is broken in latest versions of NodeJS (https://github.com/istanbuljs/nyc/issues/1530#issuecomment-177340... — committed to Azure/azure-sdk-for-js by jeremymeng 8 months ago
I looked at that now and it’s not a
nyc
bug, but aesm
one. Diff https://gist.github.com/RafaelGSS/e08193f1328bdbd18ee4d340b6fb9041