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

nyc 15 gives no coverage without the useSpawnWrap option #1303

Closed
1 task done
adjerbetian opened this issue Apr 13, 2020 · 5 comments
Closed
1 task done

nyc 15 gives no coverage without the useSpawnWrap option #1303

adjerbetian opened this issue Apr 13, 2020 · 5 comments

Comments

@adjerbetian
Copy link

Link to bug demonstration repository

https://github.com/adjerbetian/nyc-bug-demo-use-spawn

Expected Behavior

I would want to have the coverage, but I get nothing in the output

image

I tried to debug, and when I use the flag --use-spawn-wrap I get the expected result:

image

📝 This problem does not occur on nyc@14.

Observed Behavior

Troubleshooting steps

  • run npx nyc mocha --> ❌ no coverage
  • run npx nyc --use-spawn-wrap mocha --> ✔️ coverage
  • still occurring when I put cache: false in my nyc config

Environment Information

  System:
    OS: Linux 4.15 Ubuntu 18.04.4 LTS (Bionic Beaver)
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 10.25 GB / 31.07 GB
  Binaries:
    Node: 12.16.1 - /usr/bin/node
    npm: 6.14.4 - /usr/bin/npm
  npmPackages:
    nyc: ^15.0.1 => 15.0.1 
@coreyfarrell
Copy link
Member

I am not able to reproduce this issue, npx nyc mocha in your repository works correctly on Fedora 30 and Ubuntu 18.04.4.

Fedora 30 is what I run locally, I tested with node 12.16.2 installed by nvm. I tested ubuntu under docker using the ubuntu:18.04 image and again installing node.js using nvm.

This is an important issue for us to figure out as --use-spawn-wrap is an option that was added "just in case", the intent is to eventually remove it from a future semver-major.

Your environment info lists node 12.16.1 as being installed to /usr/bin/node. How did you install this? apt-get install nodejs gave me 8.10.0 and nvm doesn't install to /usr/bin.

@adjerbetian
Copy link
Author

@coreyfarrell Thank you for answering.

My ubuntu just updated the node version to 12.16.2 and the problem is gone. I tried to look at the changelog to see what it could be but it's too big.

I suppose we can close here, unless you want to keep digging.

@coreyfarrell
Copy link
Member

Thanks for the update. This is odd as I'm not seeing the issue using 12.16.1 on Fedora either. Without being able to reproduce I think we can close this issue, if you do ever see it again please be sure to post a new issue!

@danielSONCCO
Copy link

danielSONCCO commented Apr 21, 2020

@coreyfarrell do you reproduce if you employ ?

  • node 12.13.0 (edit: installed with npm)
  • nyc 15.0.1

bug looks coming of the usage of node-preload https://github.com/istanbuljs/nyc/blob/master/bin/nyc.js#L62
https://github.com/cfware/node-preload#limitations
Those limitations can explain that the result isn't deterministic

On my pc, without the useSpawnWrap option, lib/wrap.js is not executed by that preload
This causes that onExit isn't called, then writeCoverageFile isn't called

wdyt of replacing node-preload by something else ?

@coreyfarrell
Copy link
Member

Worker threads are not supported by spawn-wrap at all. node-preload is the replacement, if it is failing in a case where spawn-wrap worked I need to see a reproducible demo suit can be fixed. Be aware spawn-wrap fails in many situations, especially on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants