Open rolandtritsch opened 2 years ago
Add a/the ability to exclude files and packages to the scala3 implementation. That would be a/the preferred approach, but might take a while.
So this is my preferred way. If there isn't a feature request for this yet in the Dotty repo I'd suggest creating one there outlining the need for this.
Add a coverageExlude task to sbt-scoverage that will read the coverage from the data-dir and (re)writes it again without the excluded files and packages. That is obviously a hack. And should only be considered a workaround until the exclude functionality becomes abvailable in dotty. But this can be implemented fast and easy.
Honestly, since I'm not really actively working on scoverage I really don't want to add a hack like this in. I know this may sort of hinder people for the time being, but then hopefully that will spur on someone to add it into the compiler. So for now I'd say I don't have any intention to add that hack into the sbt plugin.
Hi!
I was upgrading some scala2 projects to scala3 and noticed some differences in coverage results, because // $COVERAGE-OFF$
comments are not respected.
So this is my preferred way. If there isn't a feature request for this yet in the Dotty repo I'd suggest creating one there outlining the need for this.
I don't see any ticket in the scala3 repo linked. Shall I create one?
Ofc, I now found https://github.com/scala/scala3/issues/17684 which was converted into a discussion
So--question... I get that these two excludes don't work yet for Scala 3, but what about '''$COVERAGE-OFF$''' and '''$COVERAGE-ON$'''? Should these be expected to work for Scala 3? So far they don't appear to do anything for me--toggled code still gets covered/reported.
Files and packages exclusion works starting Scala 3.4.2, comment exclusion is not supported yet in Scala 3, afaik
Hi All,
right now scala3 does not support to exclude any files and/or packages when instrumenting the code.
The scala2 implementation supports this.
To make migrating to scala3 painless/possible, we need to find a way to support this in scala3 (somehow).
I see two options ...
coverageExlude
task tosbt-scoverage
that will read the coverage from the data-dir and (re)writes it again without the excluded files and packages. That is obviously a hack. And should only be considered a workaround until the exclude functionality becomes abvailable in dotty. But this can be implemented fast and easy.