Closed matuzalemsteles closed 6 years ago
I prefer to use the jest configuration object over adding params to the command (--coverage
). In this case we can generate and save the reports by adding this to the jest object in the package.json
"jest": {
"collectCoverage": true,
"coverageReporters": ["json", "html", "lcov", "text"],
"coverageDirectory": "./coverage", //this is the default
...
},
Probably lcov
is enough to make coveralls or any other tool work, but html
produces a pretty intuitive coverage pages locally, highlighting the code you're not covering and why.
What do you think? 😄
Hey @carloslancha,
By using the --coverage
flag, by default jest generates reports on lcov
and html
pages so that we can view 😅. We can leave these settings explicitly as well.
Just a suggestion of use to keep control of the pr related to coverage and also as a way to expose it to other people.
Mmmm, I'm not getting the html
generated pages by default @matuzalemsteles. Looks like the default values are ["json", "lcov", "text"]
(text is console output) https://facebook.github.io/jest/docs/en/configuration.html#coveragereporters-array-string
Please, confirm this, maybe I'm doing something wrong.
But yeah, the idea is the same, my point was about my preference on keeping this kind of things configured by json 😉
Are the files generated inside the coverage/lcov-report
folder, can you see it?
Ok, don't know why that folder was ignored in my editor config 😅 Thx!
Hey @matuzalemsteles I was curious about coveralls and I've make a test to integrate it (seems sooo easy). You can take a look in https://github.com/metal/metal-clay-components/pull/176
Closing in favour of #176. @matuzalemsteles, please review and merge if you're fine with it!
Disclaimer
Just changing so that jest shows the coverage of the tests.
Coveralls
I think it's interesting to be able to show the coverage status of our tests and to follow through an interface as easy access.
coveralls is a tool that can help us when we send some PR that add some functionality and we do not add tests and our coverage drops, the tool always sends a message showing how much pr impacts on coverage. In addition to other interesting features.
What do you think about this?