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: v1.9.0
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 Sep 17, 2021

  1. Copy the full SHA
    3a1b39b View commit details
  2. Copy the full SHA
    9703a63 View commit details

Commits on Sep 18, 2021

  1. Merge pull request #371 from scala-steward/update/scalafmt-core-3.0.4

    Update scalafmt-core to 3.0.4
    ckipp01 authored Sep 18, 2021
    Copy the full SHA
    cdfeacb View commit details

Commits on Sep 22, 2021

  1. Copy the full SHA
    220a6f0 View commit details

Commits on Sep 23, 2021

  1. Merge pull request #373 from scala-steward/update/sbt-ci-release-1.5.9

    Update sbt-ci-release to 1.5.9
    ckipp01 authored Sep 23, 2021
    Copy the full SHA
    bb40ce9 View commit details

Commits on Oct 2, 2021

  1. Copy the full SHA
    00605ad View commit details

Commits on Oct 11, 2021

  1. Merge pull request #375 from scala-steward/update/scalafmt-core-3.0.6

    Update scalafmt-core to 3.0.6
    ckipp01 authored Oct 11, 2021
    Copy the full SHA
    c190f3d View commit details
  2. Ensure reporting and aggregation still works when disabling modules.

    In the past reporting and aggregation would fail when you tried to
    disable Scoverage for a specific module. This now will only take into
    account the modules that have the keys defined rather than defaulting to
    all of them.
    
    Closes #376
    ckipp01 committed Oct 11, 2021
    Copy the full SHA
    bb99b2c View commit details
  3. Merge pull request #377 from ckipp01/disabled

    Ensure reporting and aggregation still works when disabling modules.
    ckipp01 authored Oct 11, 2021
    Copy the full SHA
    28337aa View commit details

Commits on Oct 23, 2021

  1. Copy the full SHA
    388171c View commit details
  2. Copy the full SHA
    2f34ba2 View commit details
  3. Copy the full SHA
    0fc7eb6 View commit details

Commits on Oct 30, 2021

  1. Copy the full SHA
    ba36cd3 View commit details

Commits on Nov 1, 2021

  1. Copy the full SHA
    454b6fc View commit details
  2. Copy the full SHA
    7f334f7 View commit details
  3. Copy the full SHA
    37e8686 View commit details
  4. Copy the full SHA
    fa11d8d View commit details
  5. Account for M1 of scoverage

    ckipp01 committed Nov 1, 2021
    Copy the full SHA
    c0cf26c View commit details
  6. Only test on 8 and 11

    17 brought some weird issues that seem to stem from sbt. We'll look at
       these later.
    ckipp01 committed Nov 1, 2021
    Copy the full SHA
    c783dde View commit details
  7. Remove plugin version test for now.

    Since this won't work now for anything < 2.x the test won't make sense until
    we release more versions
    ckipp01 committed Nov 1, 2021
    Copy the full SHA
    f9232bd View commit details
  8. Copy the full SHA
    33d6cf1 View commit details

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
Showing with 1,082 additions and 213 deletions.
  1. +3 −0 .git-blame-ignore-revs
  2. +17 −11 .github/workflows/ci.yml
  3. +1 −1 .github/workflows/release-drafter.yml
  4. +5 −4 .github/workflows/release.yml
  5. +4 −3 .gitignore
  6. +3 −1 .scalafmt.conf
  7. +103 −59 README.md
  8. +14 −4 build.sbt
  9. +1 −1 project/build.properties
  10. +3 −3 project/plugins.sbt
  11. +4 −4 src/main/scala/scoverage/CoverageMinimum.scala
  12. +1 −3 src/main/scala/scoverage/ScoverageKeys.scala
  13. +175 −42 src/main/scala/scoverage/ScoverageSbtPlugin.scala
  14. +7 −0 src/sbt-test/scoverage/aggregate-disabled-module/a/src/main/scala/a/AdderScala.scala
  15. +8 −0 src/sbt-test/scoverage/aggregate-disabled-module/a/src/test/scala/AdderTestSuite.scala
  16. +7 −0 src/sbt-test/scoverage/aggregate-disabled-module/b/src/main/scala/b/AdderScala.scala
  17. +8 −0 src/sbt-test/scoverage/aggregate-disabled-module/b/src/test/scala/AdderTestSuite.scala
  18. +17 −0 src/sbt-test/scoverage/aggregate-disabled-module/build.sbt
  19. +7 −0 src/sbt-test/scoverage/aggregate-disabled-module/c/src/main/scala/c/AdderScala.scala
  20. +8 −0 src/sbt-test/scoverage/aggregate-disabled-module/c/src/test/scala/AdderTestSuite.scala
  21. +1 −0 src/sbt-test/scoverage/aggregate-disabled-module/project/build.properties
  22. 0 src/sbt-test/scoverage/{scalac-plugin-version → aggregate-disabled-module}/project/plugins.sbt
  23. +16 −0 src/sbt-test/scoverage/aggregate-disabled-module/test
  24. +3 −3 src/sbt-test/scoverage/aggregate-only/build.sbt
  25. +3 −3 src/sbt-test/scoverage/aggregate/build.sbt
  26. +1 −1 src/sbt-test/scoverage/aggregate/project/build.properties
  27. +3 −3 src/sbt-test/scoverage/bad-coverage-file-branch/build.sbt
  28. +3 −3 src/sbt-test/scoverage/bad-coverage-file-stmt/build.sbt
  29. +3 −3 src/sbt-test/scoverage/bad-coverage-package-branch/build.sbt
  30. +3 −3 src/sbt-test/scoverage/bad-coverage-package-stmt/build.sbt
  31. +3 −3 src/sbt-test/scoverage/bad-coverage-total-branch/build.sbt
  32. +3 −3 src/sbt-test/scoverage/bad-coverage-total-stmt/build.sbt
  33. +4 −4 src/sbt-test/scoverage/bad-coverage/build.sbt
  34. +13 −0 src/sbt-test/scoverage/coverage-excluded-files/build.sbt
  35. +1 −0 src/sbt-test/scoverage/coverage-excluded-files/project/build.properties
  36. +16 −0 src/sbt-test/scoverage/coverage-excluded-files/project/plugins.sbt
  37. +7 −0 src/sbt-test/scoverage/coverage-excluded-files/src/main/scala/GoodCoverage.scala
  38. +9 −0 src/sbt-test/scoverage/coverage-excluded-files/src/main/scala/two/GoodCoverage.scala
  39. +19 −0 src/sbt-test/scoverage/coverage-excluded-files/src/test/scala/GoodCoverageSpec.scala
  40. +9 −0 src/sbt-test/scoverage/coverage-excluded-files/test
  41. +13 −0 src/sbt-test/scoverage/coverage-excluded-packages/build.sbt
  42. +1 −0 src/sbt-test/scoverage/coverage-excluded-packages/project/build.properties
  43. +16 −0 src/sbt-test/scoverage/coverage-excluded-packages/project/plugins.sbt
  44. +7 −0 src/sbt-test/scoverage/coverage-excluded-packages/src/main/scala/GoodCoverage.scala
  45. +9 −0 src/sbt-test/scoverage/coverage-excluded-packages/src/main/scala/two/GoodCoverage.scala
  46. +19 −0 src/sbt-test/scoverage/coverage-excluded-packages/src/test/scala/GoodCoverageSpec.scala
  47. +9 −0 src/sbt-test/scoverage/coverage-excluded-packages/test
  48. +3 −4 src/sbt-test/scoverage/coverage-off/build.sbt
  49. +1 −0 src/sbt-test/scoverage/coverage-off/project/build.properties
  50. +1 −1 src/sbt-test/scoverage/coverage-off/test
  51. +3 −3 src/sbt-test/scoverage/data-dir/build.sbt
  52. +1 −1 src/sbt-test/scoverage/data-dir/project/build.properties
  53. +1 −1 src/sbt-test/scoverage/data-dir/src/main/scala/GoodCoverage.scala
  54. +2 −3 src/sbt-test/scoverage/data-dir/src/test/scala/GoodCoverageSpec.scala
  55. +3 −4 src/sbt-test/scoverage/good-coverage/build.sbt
  56. +4 −4 src/sbt-test/scoverage/preserve-set/build.sbt
  57. +2 −2 src/sbt-test/scoverage/preserve-set/test
  58. +17 −0 src/sbt-test/scoverage/scala3-bad/build.sbt
  59. +16 −0 src/sbt-test/scoverage/scala3-bad/project/plugins.sbt
  60. +10 −0 src/sbt-test/scoverage/scala3-bad/src/main/scala/BadCoverage.scala
  61. +10 −0 src/sbt-test/scoverage/scala3-bad/src/test/scala/BadCoverageSpec.scala
  62. +5 −0 src/sbt-test/scoverage/scala3-bad/test
  63. +13 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/build.sbt
  64. +1 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/project/build.properties
  65. +16 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/project/plugins.sbt
  66. +7 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/main/scala/GoodCoverage.scala
  67. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/main/scala/three/GoodCoverage.scala
  68. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/main/scala/two/GoodCoverage.scala
  69. +19 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/src/test/scala/GoodCoverageSpec.scala
  70. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-files/test
  71. +13 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt
  72. +1 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/project/build.properties
  73. +16 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/project/plugins.sbt
  74. +7 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/GoodCoverage.scala
  75. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/three/GoodCoverage.scala
  76. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/main/scala/two/GoodCoverage.scala
  77. +19 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/src/test/scala/GoodCoverageSpec.scala
  78. +9 −0 src/sbt-test/scoverage/scala3-coverage-excluded-packages/test
  79. +20 −0 src/sbt-test/scoverage/scala3-good/build.sbt
  80. +16 −0 src/sbt-test/scoverage/scala3-good/project/plugins.sbt
  81. +7 −0 src/sbt-test/scoverage/scala3-good/src/main/scala/GoodCoverage.scala
  82. +9 −0 src/sbt-test/scoverage/scala3-good/src/main/scala/two/GoodCoverage.scala
  83. +19 −0 src/sbt-test/scoverage/scala3-good/src/test/scala/GoodCoverageSpec.scala
  84. +5 −0 src/sbt-test/scoverage/scala3-good/test
  85. +13 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/build.sbt
  86. +1 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/project/build.properties
  87. +16 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/project/plugins.sbt
  88. +7 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/main/scala/GoodCoverage.scala
  89. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/main/scala/three/GoodCoverage.scala
  90. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/main/scala/two/GoodCoverage.scala
  91. +19 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/src/test/scala/GoodCoverageSpec.scala
  92. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-files/test
  93. +13 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/build.sbt
  94. +1 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/project/build.properties
  95. +16 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/project/plugins.sbt
  96. +7 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/main/scala/GoodCoverage.scala
  97. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/main/scala/three/GoodCoverage.scala
  98. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/main/scala/two/GoodCoverage.scala
  99. +19 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/src/test/scala/GoodCoverageSpec.scala
  100. +9 −0 src/sbt-test/scoverage/scala3.3.4-coverage-excluded-packages/test
  101. +0 −17 src/sbt-test/scoverage/scalac-plugin-version/build.sbt
  102. +0 −3 src/sbt-test/scoverage/scalac-plugin-version/test
  103. +3 −3 src/sbt-test/scoverage/scalajs/build.sbt
  104. +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
28 changes: 17 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -6,44 +6,50 @@ on:
- '*.md'
branches:
- main
- V2
pull_request:

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: 'adopt'
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: 'adopt'
java-version: '8'
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 }}
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -6,15 +6,16 @@ on:
tags: ["*"]
jobs:
publish:
runs-on: ubuntu-20.04
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: 'adopt'
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
4 changes: 3 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
version = "3.0.3"
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