You may use pre-exiting industry standard tools like nyc and c8 to collect the code coverage metrics from your tests.
Following are the examples of using both c8
and nyc
with Japa. Also, make sure to consult the documentation of respective tools for advanced usage.
:::caption{for="info"} Using c8 :::
npm i -D c8
{
"scripts": {
"test": "c8 node bin/test.js"
}
}
npm test
:::caption{for="info"} Using nyc :::
npm i -D nyc
{
"scripts": {
"test": "nyc node bin/test.js"
}
}
npm test