Open bd82 opened 3 years ago
One major use case: if you need coverage for ESM projects.
Thanks @aral
I wonder if c8 would work on V8 processes inside electron. For example to obtain coverage for a VSCode extension during integration tests.
@bd82 Haven’t tried it but I don’t see why not. Give it a shot and let us know? ;)
@bd82 Haven’t tried it but I don’t see why not. Give it a shot and let us know? ;)
@aral I will try to find time for this next week 😄
Thanks @aral
I wonder if c8 would work on V8 processes inside electron. For example to obtain coverage for a VSCode extension during integration tests.
If you can get access to the inspector api or dump the internal coverage data in some way, you can use c8's report function to report on coverage. We have a v8 environment that is non-node/non-electron and this is how we get code coverage. We basically invoke the inspector APIs directly, write the data to temp location and then use c8 to create our coverage reports.
c8 also might be faster for large code bases? I don't actually know if this is true as I have not tested it for node. But in theory the lack of an instrumentation phase would arguably make a CI build faster. That was the case for us, but the comparison was with a very, very old and highly customized fork of nyc so it may not be true today or in general. Perhaps worth a test though?
Unfortunately I don't seem to find the time to investigate C8 + VSCode extensions coverage...
But I found some info related to my original question here:
Hello.
I've only recently discovered C8 and was wondering how does it compare to Istanbul?
I'm making a semi educated guess that removing the need for instrumenting the files would make C8 significantly faster. And that collecting coverage from multiple sub-processes may be easier.
Basically when should I use NYC/Istanbul and when should I use C8?