New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add code coverage test-run #1231
Add code coverage test-run #1231
Conversation
Hi, thanks for the PR. You may already be aware, but we currently have test coverage in the github action: npm-check-updates/.github/workflows/test.yml Lines 54 to 62 in 2be014c
Can you explain what your PR offers beyond the current coverage? If there are additional benefits, I am open to discussing an integrated solution. |
Ah, no I had missed that CiCd step entirely. Kicking myself as I am sure I'd seen the badge when I first looked at the project.
Absolutely, The benefits of the ability to get coverage data in the local checkout are:
Personally, I have found that having coverage front-and-centre (obvious, easy, quick) mostly helps code quality, with caveats. |
2544b8b
to
670488e
Compare
No worries, it's a little out of the way.
That sounds reasonable to me. Now, can we do both local coverage and coveralls with just |
great question, I would hope/assume so, because you're right, we don't need/want both. I've not yet come across c8, but I do find NYC problematic, especially since they restructured everything from istanbul->nyc. I'll have a look at c8. |
This makes code-coverage discoverable. Rather than replace the existing test, which would require merging the coverage output of the two test-run phases (test:src and test:timeout), we add a new 'test:src:cov' script.
We ignore build/ and coverage/ out, making prettier run faster and tidier.
670488e
to
efe3f68
Compare
That was easier than I expected. I don't know how you feel about covering test code, as well as production code, but I've found that test-code coverage occasionally highlights regressions in tests. I've not reintroduced that configuration change for c8, but it looks straight forward enough to do at some point in the future. I hope you don't mind, I've thrown some typo fixes in (found via cspell, which might be worth integrating). |
Great!
I think with a larger codebase and lots of contributors this could be useful. npm-check-updates is pretty small and I personally review all the code, so it may not be as relevant here. Not that I trust my judgment over automated tools, just that changes to tests are pretty visible with the current PR review process.
Thank you! |
chore(coverage): adds code coverage to tests
Rather than replace the existing test, which would require merging the
coverage output of the two test-run phases (
test:src
andtest:timeout
),we add a new 'test:src:cov' script.
There's a couple of things we notice doing this; the first is that some
of the tests, especially doctor tests, do not report coverage because
they use sub-procs via spawn. This leads us to realise that the
test-types sometimes veer into 'integration' type tests.
We configure the coverage to:
most regressions.