c8 icon indicating copy to clipboard operation
c8 copied to clipboard

Documentation Request - pros / cons vs Istanbul

Open bd82 opened this issue 5 years ago • 6 comments

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?

bd82 avatar Jan 26 '21 07:01 bd82

One major use case: if you need coverage for ESM projects.

aral avatar Feb 28 '21 16:02 aral

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 avatar Mar 02 '21 10:03 bd82

@bd82 Haven’t tried it but I don’t see why not. Give it a shot and let us know? ;)

aral avatar Mar 03 '21 07:03 aral

@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 😄

bd82 avatar Mar 03 '21 12:03 bd82

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?

j03m avatar Mar 11 '21 10:03 j03m

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:

  • https://github.com/facebook/jest/issues/11188

bd82 avatar Apr 22 '21 13:04 bd82