Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scoverage/sbt-scoverage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0-M1
Choose a base ref
...
head repository: scoverage/sbt-scoverage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Nov 2, 2021

  1. Bump default version of scoverage to 2.0.0-M3

    This is to support 2.13.7
    ckipp01 committed Nov 2, 2021
    Copy the full SHA
    a4cb3d3 View commit details

Commits on Nov 3, 2021

  1. Copy the full SHA
    d7df279 View commit details

Commits on Jan 11, 2022

  1. dep: update sbt to 1.6.1

    ckipp01 committed Jan 11, 2022
    Copy the full SHA
    3d9da12 View commit details
  2. Copy the full SHA
    1671af1 View commit details
  3. Copy the full SHA
    73f8f92 View commit details

Commits on May 19, 2022

  1. Copy the full SHA
    d098325 View commit details
  2. Copy the full SHA
    e4a3811 View commit details
  3. Copy the full SHA
    3783193 View commit details
  4. Copy the full SHA
    5af259b View commit details

Commits on Jun 3, 2022

  1. Add support for Scala 3

    pikinier20 authored and ckipp01 committed Jun 3, 2022
    Copy the full SHA
    47458fb View commit details
  2. Add condition on Scala 3 version

    pikinier20 authored and ckipp01 committed Jun 3, 2022
    Copy the full SHA
    7c804ed View commit details
  3. Bump actions/checkout from 2 to 3

    Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v2...v3)
    
    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and ckipp01 committed Jun 3, 2022
    Copy the full SHA
    acd61a8 View commit details
  4. Bump actions/setup-java from 2 to 3

    Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2 to 3.
    - [Release notes](https://github.com/actions/setup-java/releases)
    - [Commits](actions/setup-java@v2...v3)
    
    ---
    updated-dependencies:
    - dependency-name: actions/setup-java
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and ckipp01 committed Jun 3, 2022
    Copy the full SHA
    636111f View commit details

Commits on Jun 8, 2022

  1. feat: add support for 2.12.16 with newest scoverage

    This bumps the version of scoverage to the 2.0.0-RC1.
    
    NOTE: That will this it also removes the long deprecated
    `coverageMinimum`. You'll need to replace it with
    `coverageMinimumStmtTotal`.
    ckipp01 committed Jun 8, 2022
    Copy the full SHA
    d86faca View commit details
  2. Copy the full SHA
    cc1ff39 View commit details

Commits on Jun 14, 2022

  1. deps: update scoverage to 2.0.0-RC2

    This notably brings in support for the Scala native runtime.
    ckipp01 committed Jun 14, 2022
    Copy the full SHA
    a4a7ce7 View commit details

Commits on Jun 25, 2022

  1. dep: bump to scoverage 2.0

    ckipp01 committed Jun 25, 2022
    Copy the full SHA
    732c4c1 View commit details

Commits on Jun 29, 2022

  1. Update scalafmt-core to 3.5.8

    scala-steward authored and ckipp01 committed Jun 29, 2022
    Copy the full SHA
    0accf82 View commit details

Commits on Jul 5, 2022

  1. Copy the full SHA
    7e5059a View commit details
  2. Make regex more expressive.

    rolandtritsch authored and ckipp01 committed Jul 5, 2022
    Copy the full SHA
    7aa67e7 View commit details
  3. Copy the full SHA
    12aac64 View commit details

Commits on Jul 12, 2022

  1. Copy the full SHA
    e164e34 View commit details

Commits on Jul 27, 2022

  1. Copy the full SHA
    36fd3a7 View commit details

Commits on Jul 30, 2022

  1. Add sbt-vspp for publishing the SBT plug-in in a Maven-consistent format

    This is to enable usage of sbt-scoverage in Enterprise environments where only the valid-POM format is accepted for JAR downloads, enabling it for many teams to move from Gradle/Maven to SBT for their Scala (and even non-Scala projects)
    
    More background here: https://github.com/esbeetee/sbt-vspp/blob/main/README.md
    ScalaWilliam authored and ckipp01 committed Jul 30, 2022
    Copy the full SHA
    206a7c1 View commit details

Commits on Aug 8, 2022

  1. chore: make it clearer that the user should update to 3.2.x

    Right now there isn't a lot of support if you try to use coverage under
    3.1.x for example. This will show you a warning that you need to update to
    3.2.x if you try with a Scala 3 version that isn't new enough.
    ckipp01 committed Aug 8, 2022
    Copy the full SHA
    98515aa View commit details
  2. Copy the full SHA
    eb9b6e2 View commit details

Commits on Aug 13, 2022

  1. Update scalafmt-core to 3.5.9

    scala-steward authored and ckipp01 committed Aug 13, 2022
    Copy the full SHA
    711b5d1 View commit details
  2. Reformat with scalafmt 3.5.9

    Executed command: scalafmt --non-interactive
    scala-steward authored and ckipp01 committed Aug 13, 2022
    Copy the full SHA
    b5df13e View commit details
  3. Copy the full SHA
    3e9030a View commit details

Commits on Sep 2, 2022

  1. Fix typo on Scala version check

    Just fixes a small typo on the Scala 3.2.x warning.
    JD557 authored and ckipp01 committed Sep 2, 2022
    Copy the full SHA
    88d811e View commit details

Commits on Sep 15, 2022

  1. Copy the full SHA
    b0cd01b View commit details

Commits on Sep 20, 2022

  1. Copy the full SHA
    1e69c10 View commit details

Commits on Oct 10, 2022

  1. Copy the full SHA
    98c69fb View commit details

Commits on Oct 20, 2022

  1. Allow sbt-scoverage to work on Windows

    The -Xplugin option expects a classpath string with multiple paths
    separated by a semicolon or colon depending on the operating system.
    However, this currently always uses a colon, which doesn't work on
    Windows. This means scalac cannot find the scoverage plugin jars and
    leads to errors about "bad options".
    
    This modifies the -Xplugin logic to use File.pathSeparator when building
    the Xplugin classpath, allowing it to work regardless of operating
    system.
    
    Also modifies excludedPackages when on Windows to replace Unix path
    separators with Windows path separators (which are escaped because it is
    treated as a regular expression). Modifies tests to remove unnecessary
    escaping of Unix separators that results in an invalid regex due to this
    replacement on Windows.
    
    Note that two tests currently prevent CI from working on Windows:
    coverage-off and preserve-set. The reason for these failures on Windows
    is not clear, but these changes at least allow the common uses to work
    on Windows.
    stevedlawrence authored and ckipp01 committed Oct 20, 2022
    Copy the full SHA
    8ba258c View commit details

Commits on Oct 22, 2022

  1. Update scalafmt-core to 3.6.0

    scala-steward authored and ckipp01 committed Oct 22, 2022
    Copy the full SHA
    e57515c View commit details
  2. Copy the full SHA
    0301435 View commit details
  3. Update sbt-ci-release to 1.5.11

    scala-steward authored and ckipp01 committed Oct 22, 2022
    Copy the full SHA
    fda7688 View commit details

Commits on Nov 5, 2022

  1. Update scalafmt-core to 3.6.1

    scala-steward authored and ckipp01 committed Nov 5, 2022
    Copy the full SHA
    ada27ce View commit details
  2. Copy the full SHA
    8b7ca7c View commit details

Commits on Nov 13, 2022

  1. Copy the full SHA
    bd7feac View commit details

Commits on Nov 15, 2022

  1. Update sbt-scalafmt to 2.5.0

    scala-steward authored and ckipp01 committed Nov 15, 2022
    Copy the full SHA
    c21e5e6 View commit details

Commits on Jan 24, 2023

  1. Copy the full SHA
    b6b47b3 View commit details
  2. Update scalafmt-core to 3.7.0

    scala-steward authored and ckipp01 committed Jan 24, 2023
    Copy the full SHA
    d69749b View commit details

Commits on Jan 26, 2023

  1. Update scalafmt-core to 3.7.1

    scala-steward authored and ckipp01 committed Jan 26, 2023
    Copy the full SHA
    839c979 View commit details

Commits on Feb 10, 2023

  1. Copy the full SHA
    4239995 View commit details

Commits on Feb 27, 2023

  1. Update scalafmt-core to 3.7.2

    scala-steward authored and ckipp01 committed Feb 27, 2023
    Copy the full SHA
    4793eb6 View commit details

Commits on Mar 29, 2023

  1. Update scalafmt-core to 3.7.3

    scala-steward authored and ckipp01 committed Mar 29, 2023
    Copy the full SHA
    e5ced78 View commit details

Commits on May 3, 2023

  1. Update sbt-ci-release to 1.5.12

    scala-steward authored and ckipp01 committed May 3, 2023
    Copy the full SHA
    2a9f61d View commit details

Commits on May 28, 2023

  1. Copy the full SHA
    7aa4f54 View commit details

Commits on Jun 2, 2023

  1. Update scalafmt-core to 3.7.4

    scala-steward authored and ckipp01 committed Jun 2, 2023
    Copy the full SHA
    a2453c0 View commit details
Showing with 894 additions and 173 deletions.
  1. +3 −0 .git-blame-ignore-revs
  2. +13 −8 .github/workflows/ci.yml
  3. +1 −1 .github/workflows/release-drafter.yml
  4. +3 −2 .github/workflows/release.yml
  5. +4 −3 .gitignore
  6. +1 −1 .scalafmt.conf
  7. +103 −59 README.md
  8. +14 −7 build.sbt
  9. +1 −1 project/build.properties
  10. +3 −3 project/plugins.sbt
  11. +1 −3 src/main/scala/scoverage/CoverageMinimum.scala
  12. +0 −3 src/main/scala/scoverage/ScoverageKeys.scala
  13. +77 −25 src/main/scala/scoverage/ScoverageSbtPlugin.scala
  14. +3 −3 src/sbt-test/scoverage/aggregate-disabled-module/build.sbt
  15. +1 −1 src/sbt-test/scoverage/aggregate-disabled-module/project/build.properties
  16. +3 −3 src/sbt-test/scoverage/aggregate-only/build.sbt
  17. +3 −3 src/sbt-test/scoverage/aggregate/build.sbt
  18. +1 −1 src/sbt-test/scoverage/aggregate/project/build.properties
  19. +3 −3 src/sbt-test/scoverage/bad-coverage-file-branch/build.sbt
  20. +3 −3 src/sbt-test/scoverage/bad-coverage-file-stmt/build.sbt
  21. +3 −3 src/sbt-test/scoverage/bad-coverage-package-branch/build.sbt
  22. +3 −3 src/sbt-test/scoverage/bad-coverage-package-stmt/build.sbt
  23. +3 −3 src/sbt-test/scoverage/bad-coverage-total-branch/build.sbt
  24. +3 −3 src/sbt-test/scoverage/bad-coverage-total-stmt/build.sbt
  25. +4 −4 src/sbt-test/scoverage/bad-coverage/build.sbt
  26. +13 −0 src/sbt-test/scoverage/coverage-excluded-files/build.sbt
  27. +1 −0 src/sbt-test/scoverage/coverage-excluded-files/project/build.properties
  28. +16 −0 src/sbt-test/scoverage/coverage-excluded-files/project/plugins.sbt
  29. +7 −0 src/sbt-test/scoverage/coverage-excluded-files/src/main/scala/GoodCoverage.scala
  30. +9 −0 src/sbt-test/scoverage/coverage-excluded-files/src/main/scala/two/GoodCoverage.scala
  31. +19 −0 src/sbt-test/scoverage/coverage-excluded-files/src/test/scala/GoodCoverageSpec.scala
  32. +9 −0 src/sbt-test/scoverage/coverage-excluded-files/test
  33. +13 −0 src/sbt-test/scoverage/coverage-excluded-packages/build.sbt
  34. +1 −0 src/sbt-test/scoverage/coverage-excluded-packages/project/build.properties
  35. +16 −0 src/sbt-test/scoverage/coverage-excluded-packages/project/plugins.sbt
  36. +7 −0 src/sbt-test/scoverage/coverage-excluded-packages/src/main/scala/GoodCoverage.scala
  37. +9 −0 src/sbt-test/scoverage/coverage-excluded-packages/src/main/scala/two/GoodCoverage.scala
  38. +19 −0 src/sbt-test/scoverage/coverage-excluded-packages/src/test/scala/GoodCoverageSpec.scala
  39. +9 −0 src/sbt-test/scoverage/coverage-excluded-packages/test
  40. +3 −4 src/sbt-test/scoverage/coverage-off/build.sbt
  41. +1 −0 src/sbt-test/scoverage/coverage-off/project/build.properties
  42. +1 −1 src/sbt-test/scoverage/coverage-off/test
  43. +3 −3 src/sbt-test/scoverage/data-dir/build.sbt
  44. +1 −1 src/sbt-test/scoverage/data-dir/project/build.properties
  45. +3 −4 src/sbt-test/scoverage/good-coverage/build.sbt
  46. +4 −4 src/sbt-test/scoverage/preserve-set/build.sbt
  47. +2 −2 src/sbt-test/scoverage/preserve-set/test
  48. +17 −0 src/sbt-test/scoverage/scala3-bad/build.sbt
  49. +16 −0 src/sbt-test/scoverage/scala3-bad/project/plugins.sbt
  50. +10 −0 src/sbt-test/scoverage/scala3-bad/src/main/scala/BadCoverage.scala
  51. +10 −0 src/sbt-test/scoverage/scala3-bad/src/test/scala/BadCoverageSpec.scala
  52. +5 −0 src/sbt-test/scoverage/scala3-bad/test
  53. +13 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/build.sbt
  54. +1 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/project/build.properties
  55. +16 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/project/plugins.sbt
  56. +7 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/main/scala/GoodCoverage.scala
  57. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/main/scala/three/GoodCoverage.scala
  58. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/main/scala/two/GoodCoverage.scala
  59. +19 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/test/scala/GoodCoverageSpec.scala
  60. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/test
  61. +13 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt
  62. +1 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/project/build.properties
  63. +16 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/project/plugins.sbt
  64. +7 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/GoodCoverage.scala
  65. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/three/GoodCoverage.scala
  66. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/two/GoodCoverage.scala
  67. +19 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/test/scala/GoodCoverageSpec.scala
  68. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/test
  69. +20 −0 src/sbt-test/scoverage/scala3-good/build.sbt
  70. +16 −0 src/sbt-test/scoverage/scala3-good/project/plugins.sbt
  71. +7 −0 src/sbt-test/scoverage/scala3-good/src/main/scala/GoodCoverage.scala
  72. +9 −0 src/sbt-test/scoverage/scala3-good/src/main/scala/two/GoodCoverage.scala
  73. +19 −0 src/sbt-test/scoverage/scala3-good/src/test/scala/GoodCoverageSpec.scala
  74. +5 −0 src/sbt-test/scoverage/scala3-good/test
  75. +13 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/build.sbt
  76. +1 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/project/build.properties
  77. +16 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/project/plugins.sbt
  78. +7 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/main/scala/GoodCoverage.scala
  79. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/main/scala/three/GoodCoverage.scala
  80. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/main/scala/two/GoodCoverage.scala
  81. +19 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/test/scala/GoodCoverageSpec.scala
  82. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/test
  83. +13 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/build.sbt
  84. +1 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/project/build.properties
  85. +16 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/project/plugins.sbt
  86. +7 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/main/scala/GoodCoverage.scala
  87. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/main/scala/three/GoodCoverage.scala
  88. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/main/scala/two/GoodCoverage.scala
  89. +19 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/test/scala/GoodCoverageSpec.scala
  90. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/test
  91. +3 −3 src/sbt-test/scoverage/scalajs/build.sbt
  92. +2 −2 src/sbt-test/scoverage/scalajs/project/plugins.sbt
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -4,3 +4,6 @@
#
# Added scalafmt
af2396558918fea00eaa2da12906a3012eb72153

# Scala Steward: Reformat with scalafmt 3.5.9
e233420d8f4cdd863932d3c1c41deb2da6c1bace
21 changes: 13 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -11,40 +11,45 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '8', '11' ]
java: [ '8', '17' ]
os: [ 'ubuntu-latest' ]

steps:
- name: checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: sbt/setup-sbt@v1

- name: Set up JVM
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Run tests
run: sbt scripted
run: sbt scripted "++ 3.x" test

formatting:
runs-on: ubuntu-latest

steps:
- name: checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JVM
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'

- uses: sbt/setup-sbt@v1

- name: Check Formatting
run: sbt scalafmtCheckAll
run: sbt scalafmtSbtCheck "+ scalafmtCheckAll"
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -8,13 +8,14 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v2
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- uses: sbt/setup-sbt@v1
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,9 +8,10 @@ target/
.project
.settings/

# Scala-IDE specific
.cache-main
.cache-tests
# Metals specific
.bsp
metals.sbt
.metals

# IntelliJ IDEA specific
.idea
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "3.0.8"
version = "3.9.4"
project.git = true
runner.dialect = "scala213"
162 changes: 103 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
# sbt-scoverage

[![Gitter](https://img.shields.io/gitter/room/scoverage/scoverage.svg)](https://gitter.im/scoverage/scoverage)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.scoverage/sbt-scoverage/badge.svg?kill_cache=1)](https://search.maven.org/artifact/org.scoverage/sbt-scoverage/)
[![License](http://img.shields.io/:license-Apache%202-red.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
[![gitter-badge][]][gitter]
[![maven-badge][]][maven]
[![license-badge][]][license]

sbt-scoverage is a plugin for sbt that integrates the scoverage code coverage
library. Find out more about
[scoverage here](https://github.com/scoverage/scalac-scoverage-plugin).
sbt-scoverage is an sbt plugin that offers support for Scala code
coverage using [scoverage][]. This plugin supports Scala 2.12, 2.13,
and 3.

**NOTE**: ScalaJS and Scala Native support is limited to Scala 2.

**NOTE**: Scala 3 support starts with 3.2.x.

## Setup

**Requirements**: Requires sbt 1.2.8 or above
**Requirements**: Requires sbt 1.2.8 or above.

In `project/plugins.sbt`:
```scala
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "x.x.x")
```

If you are in an enterprise environment, and the above does not work, try:
```scala
libraryDependencies += "org.scoverage" % "sbt-scoverage_2.12_1.0" % "x.x.x"
```

## Usage

Run the tests with enabled coverage:
```
$ sbt clean coverage test
sbt clean coverage test
```
or if you have integration tests as well
```
$ sbt clean coverage it:test
sbt clean coverage it:test
```

To enable coverage directly in your build, use:
@@ -35,43 +44,57 @@ coverageEnabled := true

To generate the coverage reports run
```
$ sbt coverageReport
sbt coverageReport
```

Coverage reports will be in your `target/scala-<scala-version>/scoverage-report`
directory. There are HTML and XML reports. The XML is useful if you need to
programatically use the results, or if you're writing a tool.
Coverage reports will be in your
`target/scala-<scala-version>/scoverage-report` directory. There are
HTML and XML reports. The XML is useful if you need to programatically
use the results, or if you're writing a tool.

**NOTE**: If you're running the coverage reports from within an sbt console
session (as opposed to one command per sbt launch), then the `coverage` command
is sticky. To turn it back off when you're done running reports, use the
`coverageOff` command or reset `coverageEnabled` with `set coverageEnabled :=
false`.
**NOTE**: If you're running the coverage reports from within an sbt
console session (as opposed to one command per sbt launch), then the
`coverage` command is sticky. To turn it back off when you're done
running reports, use the `coverageOff` command or reset
`coverageEnabled` with `set coverageEnabled := false`.

### Multi project reports

By default, scoverage will generate reports for each project separately. You can
merge them into an aggregated report by using the following:
By default, scoverage will generate reports for each project
separately. You can merge them into an aggregated report by using the
following:

```
$ sbt coverageAggregate
```

**NOTE**: You do not need to run `coverageReport` before `coverageAggregate`; it
aggregates over the sub-projects' coverage data directly, not the report xml.
**NOTE**: You do not need to run `coverageReport` before
`coverageAggregate`; it aggregates over the sub-projects' coverage
data directly, not the report xml.

### Exclude classes and packages
### Exclude classes and packages and files

You can exclude classes from being considered for coverage measurement by
providing semicolon-separated list of regular expressions.
You can exclude classes from being considered for coverage measurement
by providing semicolon-separated list of regular expressions.

```scala
coverageExcludedPackages := "<empty>;Reverse.*;.*AuthService.*;models\\.data\\..*"
```

The regular expressions are matched against the fully qualified class name, and
must match the entire string to take effect. Any matched classes will not be
instrumented or included in the coverage report.
The regular expressions are matched against the fully qualified class
name, and must match the entire string to take effect. Any matched
classes will not be instrumented or included in the coverage report.

You can also exclude files and file paths.

```scala
coverageExcludedFiles := ".*\\/two\\/GoodCoverage;.*\\/three\\/.*"
```

**NOTE**: The `.scala` file extension needs to be omitted from the
filename, if one is given.

**NOTE**: These two options only work for Scala2, Scala 3.3.4+ and Scala 3.4.2+.

You can also mark sections of code with comments like:

@@ -84,6 +107,8 @@ You can also mark sections of code with comments like:
Any code between two such comments will not be instrumented or included in the
coverage report.

**NOTE**: Comments exclusion works only for Scala2.

### Minimum coverage

Based on minimum coverage, you can fail the build with the following keys:
@@ -98,13 +123,14 @@ coverageMinimumStmtPerFile := 85
coverageMinimumBranchPerFile := 80
```

These settings will be enforced when the reports are generated. If you generate
an aggregate report using `coverageAggregate` then these settings will apply to
that report.
These settings will be enforced when the reports are generated. If
you generate an aggregate report using `coverageAggregate` then these
settings will apply to that report.

### Override Location for Coverage Data And Report

If desired, one could override the default location for generating the sbt report and data through setting `coverageDataDir`:
If desired, one could override the default location for generating the
sbt report and data through setting `coverageDataDir`:

Example in data-dir test:
```scala
@@ -116,52 +142,70 @@ Can also be set through the sbt set directive
set coverageDataDir := file("/tmp")
```


## Trouble-shooting failing tests

scoverage does a lot of file writing behind the scenes in order to track which
statements have been executed. If you are running into a scenario where your
tests normally pass, but fail when scoverage is enabled, then the culprit can be
one of the following:
scoverage does a lot of file writing behind the scenes in order to
track which statements have been executed. If you are running into a
scenario where your tests normally pass, but fail when scoverage is
enabled, then the culprit can be one of the following:

* timing issues on futures and other async operations, try upping the timeouts by an order of magnitude.
* tests are run in a sandbox mode (such as with `java.security.PrivilegedAction<T>`), try running the tests outside of the sandbox.
* timing issues on futures and other async operations, try upping the
timeouts by an order of magnitude.
* tests are run in a sandbox mode (such as with
`java.security.PrivilegedAction<T>`), try running the tests outside
of the sandbox.

## Example project

[the scoverage samples project](https://github.com/scoverage/sbt-scoverage-samples).
To see the plugin in action you can checkout the scoverage [samples][]
project.

## Integrations

### Codacy

[Codacy](https://www.codacy.com) integrates with your favorite coverage tool to
provide an in-depth overlook of your project status. scoverage information can
be integrated into Codacy through the
[codacy-coverage-reporter](https://github.com/codacy/codacy-coverage-reporter).
[Codacy][] integrates with your favorite coverage tool to provide an
in-depth overlook of your project status. scoverage information can be
integrated into Codacy through the [codacy-coverage-reporter][].

### Coveralls

If you have an open source project then you can add code coverage metrics with
the [Coveralls](https://coveralls.io/). scoverage will integrate with coveralls
using the [sbt-coveralls](https://github.com/scoverage/sbt-coveralls) plugin.
If you have an open source project then you can publish the code
coverage metrics with [Coveralls][]. This plugin will integrate with
coveralls using the [sbt-coveralls][] plugin.

### Codecov

You can integrate with [Codecov](https://about.codecov.io/) easily sending your
reports there via your CI. You can see an example of this here in
[codecov/example-scala](https://github.com/codecov/example-scala).
You can also integrate with [Codecov][] by sending your reports there
via your CI. You can see an example in [codecov-example-scala][].

### Plugin for SonarQube
### SonarQube

If you want to visually browse statement coverage reports then use this [plugin
for SonarQube](https://github.com/RadoBuransky/sonar-scoverage-plugin). It
allows you to review overall project statement coverage as well as dig deeper
into sub-modules, directories and source code files to see uncovered statements.
Statement coverage measurement can become an integral part of your team's
continuous integration process and a required quality standard.
If you want to visually browse coverage reports then you can use the
[SonarQube][] plugin. It allows you to review overall project
statement coverage as well as dig deeper into sub-modules, directories
and source code files to see uncovered statements. Statement coverage
measurement can become an integral part of your team's continuous
integration process and a required quality standard.

## Release Notes

For any information on releases and upgrading, please refer to the [release
page](https://github.com/scoverage/sbt-scoverage/releases).
For any information on releases and upgrading, please refer to the
[release][] page.

[Codacy]: https://www.codacy.com
[Codecov]: https://about.codecov.io
[Coveralls]: https://coveralls.io
[SonarQube]: https://github.com/RadoBuransky/sonar-scoverage-plugin
[codacy-coverage-reporter]: https://github.com/codacy/codacy-coverage-reporter
[codecov-example-scala]: https://github.com/codecov/example-scala
[gitter-badge]: https://img.shields.io/gitter/room/scoverage/scoverage.svg
[gitter]: https://gitter.im/scoverage/scoverage
[license-badge]: http://img.shields.io/:license-Apache%202-red.svg
[license]: http://www.apache.org/licenses/LICENSE-2.0.txt
[maven-badge]: https://index.scala-lang.org/scoverage/sbt-scoverage/sbt-scoverage/latest.svg
[maven]: https://search.maven.org/artifact/org.scoverage/sbt-scoverage
[release]: https://github.com/scoverage/sbt-scoverage/releases
[samples]: https://github.com/scoverage/sbt-scoverage-samples
[sbt-coveralls]: https://github.com/scoverage/sbt-coveralls
[scoverage]: https://github.com/scoverage/scalac-scoverage-plugin
Loading