2
votes

I would like to generate one coverage report per test run, instead of for a whole test suite. What I do is that I extract all individual tests then run TASTY_PATTERN=testname stack test proj --coverage for each test, archiving the generated HTML report file between each test. This works but the generated reports are always reporting values as if all tests had been run, with coverage information in files that could not possibly have been touch by a test.

What do I need to do to properly cleanup the data and generate this information?

1
maybe splitting your test suite as desired and running stack clean; stack build; stack path --local-hpc-root PATH-FOR-projA; stack test projA --coverage and so on. An other solution is described in the stack docs - palik
We have about 50 tests (and counting) so it is not a solution to split each individual test into its own package. There is something I don't quite understand here: where does coverage information for functions that are not run as part of the single test I am running come from? - insitu
Unfortunately I haven't answer to your question. Maybe posting it at github.com/commercialhaskell/stack/issues will help - palik

1 Answers

0
votes

It happens this issue was caused by some test code being executed as part of test tree creation and not test tree execution, so even when filtering all tests but one, we would accrue coverage for this code without any report.