loading...
Cover image for C8 a native V8 code-coverage

C8 a native V8 code-coverage

wakeupmh profile image Marcos Henrique ・1 min read

Originally created by Benjamin E. Coe one of the maintainers of istanbul, is based on code-coverage using Node.js' built in functionality that's compatible with Istanbul's reporters, with 100k of downloads on npm, it's an awesome alternative for the most popular command line tool for instrumenting code coverage nyc.

Like nyc, c8 just magically works:

yarn global add c8
c8 node xpto.js

But why did you use this c8 instead of nyc? 🀨

First of all i will clarify about my motivation πŸ€”

I've been working on a project in node.js, using mocha and chai for the tests, this project uses esm and because of this I had some problems with nyc, he couldn't identify the files and raise the coverage of each one, I followed what the community recommended and nothing, my tech lead (a.k.a mister Snack) suggested refactoring all import a from 'a' to const a = require('a'), however, I didn't want to have all this work πŸ˜…

So I looked for some alternative and discovered the c8, that I could generate the reporters in the same way as I would with nyc, and because it is based on V8's built in coverage

It's a great tool, and here's the tip if you want to try a new technology.

You can see more about c8 here.

GitHub logo bcoe / c8

output coverage reports using Node.js' built in coverage



🍻

Posted on Oct 30 '19 by:

wakeupmh profile

Marcos Henrique

@wakeupmh

"Programming isn't about what you know; it's about what you can figure out.”

Discussion

markdown guide