Unable to get coverage for files executed via runInThisContext
skerit opened this issue · 1 comments
skerit commented
Link to bug demonstration repository
Here's the repository:
https://github.com/11ways/protoblast
I load most files via the vm
module's runInThisContext
.
With a filename option.
Expected Behavior
Running the coverage script should generate coverage for the files loaded this way.
Observed Behavior
It only shows coverage for the files executed via the require
function.
Environment Information
System:
OS: Linux 6.6 Arch Linux
CPU: (16) x64 AMD Ryzen 7 3800X 8-Core Processor
Memory: 35.82 GB / 62.72 GB
Binaries:
Node: 20.8.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.1.0 - /usr/local/bin/npm
pnpm: 7.24.3 - /usr/local/bin/pnpm
bun: 1.0.6 - ~/.bun/bin/bun
npmPackages:
istanbul-lib-instrument: ~4.0.3 => 4.0.3
nyc: ^15.1.0 => 15.1.0
skerit commented
Couldn't get this to work in nyc
, but I discovered the c8
package (which is actively maintained) and it works fine in there!