Right now I have a monorepo using lerna, each package has it's own tests / coverage tools, meaning one package can use ava + nyc another can use jest. I am building the coverage for each package individually so each package has it's own coverage folder. This is causing lerna to be unable to tell which packages to update when I publish because, whenever I run a new test, I have a commit littered with new coverage files all because of this one line:
Code coverage generated by istanbul at Wed Apr 25 2018 00:03:42 GMT-0400 (EDT)
I've tracked down the footer in istanbul and could possibly add a new reporter that would not have the timestamp in the footer, the chances of istanbul taking this change in is slim.
I am looking for a way using git / diffing to ignore (checkout) a change to this line in a file. The issue is there's no consistent way (possibly regex) to ignore this file, meaning it's not always going to be on the same line. So I can't use a patch file.
I would love any suggestions for ignoring a given change to a specific file like this.
Options:
jsdom parse the html files with node and remove the timestamp all together and update the coverage files after the coverage script has run.Looking for suggestions!
I solved this problem in a bit of a different way.
A. I altered the coverage reporters to only provide JSON which don't contain any specific timestamp data.
lerna exec -- "json -I -e \"this.jest.coverageReporters=['json']\" -f ./package.json"
B. I deleted all the reports only leaving the JSON
lerna exec -- rm -rf ./coverage/lcov-report
C. Added script to parent project to build coverage (merging all json files)
istanbul report --include=./packages/**/coverage/coverage-final.json
This has the added benefit of generating one site for all packages regardless of how the packages are being tested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With