Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get coverage for files executed via runInThisContext #1547

Open
skerit opened this issue Feb 14, 2024 · 1 comment
Open

Unable to get coverage for files executed via runInThisContext #1547

skerit opened this issue Feb 14, 2024 · 1 comment

Comments

@skerit
Copy link

skerit commented Feb 14, 2024

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
Copy link
Author

skerit commented Mar 15, 2024

Couldn't get this to work in nyc, but I discovered the c8 package (which is actively maintained) and it works fine in there!

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

No branches or pull requests

1 participant