Disable doctest in coverage
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
Whilst testing the sbt-scoverage plugin for scala.js on the cats code, I noticed that there was greater test coverage in JVM. Turns out that this is because doctest is currently jvm only and there is some code that is not tested in the real tests, but happen to be called in doctest where the methods are in a comment. E.g. Bifunctor.leftWiden and all of Choice. About 1% of tests are like this.
So doctest should be disabled in coverage, so that the proper test coverage is measured. It could be that the doctest really tests the code, but more likely is just an example of usage.
OTOH.. @andyscott recently had a PR https://github.com/typelevel/cats/pull/1352 with two lines missed
Turns out this a bug in scoverage-scalac-plugin as it currently "detects" macro implementations by looking at methods that return an Expr, and here a Tree is returned. So actually, the whole macro method should be excluded, but currently is included.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing JVM and Scala.js coverage behavior for doctest, then inspect the scoverage-scalac-plugin handling described in the issue. Check cats/arrow/FunctionK.scala around line 120 and the related macro coverage behavior. Done means coverage excludes doctest-only calls and correctly excludes the affected macro implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100