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.
๐ป
Top comments (0)