meow icon indicating copy to clipboard operation
meow copied to clipboard

What is the test coverage?

Open SandZn opened this issue 2 years ago • 5 comments

I ran the npm run test, and got a result of "57 tests passed". Is there any information about the radio on test coverage?

SandZn avatar Jun 30 '22 14:06 SandZn

You can run AVA with the --verbose flag to list every tests when they are passed.

npx ava --verbose

Or else you can look at the test directory to have deep insights on the tests. I hope that answers your question.

Caesarovich avatar Jul 05 '22 11:07 Caesarovich

Thanks for the reply. I can list all tests that are passed, and there are 57 tests in total. But sadly, I still don't know the code coverage information of the test. (Some npm packages show their code coverage such as 94% or 100%.)

SandZn avatar Jul 18 '22 20:07 SandZn

You can run ava with c8 to calculate code coverage: https://github.com/avajs/ava/blob/main/docs/recipes/code-coverage.md

Though bigger question is: What causes your interest?

It's easy to get a 100% test coverage, it's much harder to write tests that actually verifies the intended functionality.

Highlighting code coverage isn't very useful and not a very good metric to eg. evaluate modules by.

voxpelli avatar Jul 20 '22 05:07 voxpelli

Cool! c8 works well. Thanks for the advice 🌹

I'm doing research about Software Analysis; I need to collect popular projects with high code coverage tests.😊

SandZn avatar Jul 20 '22 09:07 SandZn

Such a cool discussion :)

dilraj-vidyard avatar Dec 18 '22 03:12 dilraj-vidyard