{"id":13665249,"url":"https://github.com/scoverage/sbt-scoverage","last_synced_at":"2026-01-16T07:39:41.184Z","repository":{"id":17075315,"uuid":"19840282","full_name":"scoverage/sbt-scoverage","owner":"scoverage","description":"sbt plugin for scoverage","archived":false,"fork":false,"pushed_at":"2025-03-14T06:49:48.000Z","size":606,"stargazers_count":652,"open_issues_count":38,"forks_count":158,"subscribers_count":28,"default_branch":"main","last_synced_at":"2025-03-14T07:32:29.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scoverage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-16T00:58:21.000Z","updated_at":"2025-03-14T06:49:52.000Z","dependencies_parsed_at":"2023-10-02T11:00:21.185Z","dependency_job_id":"d6d603d9-b1e6-45e1-8396-90afed544e14","html_url":"https://github.com/scoverage/sbt-scoverage","commit_stats":{"total_commits":598,"total_committers":74,"mean_commits":8.08108108108108,"dds":0.6187290969899666,"last_synced_commit":"4793eb6317732f1e7abef974e4ce6867a52fc1e4"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoverage%2Fsbt-scoverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoverage%2Fsbt-scoverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoverage%2Fsbt-scoverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scoverage%2Fsbt-scoverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scoverage","download_url":"https://codeload.github.com/scoverage/sbt-scoverage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250959877,"owners_count":21514351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T06:00:30.772Z","updated_at":"2026-01-16T07:39:41.175Z","avatar_url":"https://github.com/scoverage.png","language":"Scala","readme":"# sbt-scoverage\n\n[![gitter-badge][]][gitter]\n[![maven-badge][]][maven]\n[![license-badge][]][license]\n\nsbt-scoverage is an sbt plugin that offers support for Scala code\ncoverage using [scoverage][]. This plugin supports Scala 2.12, 2.13,\nand 3.\n\n**NOTE**: ScalaJS and Scala Native support is limited to Scala 2.\n\n**NOTE**: Scala 3 support starts with 3.2.x.\n\n## Setup\n\n**Requirements**: Requires sbt 1.2.8 or above.\n\nIn `project/plugins.sbt`:\n```scala\naddSbtPlugin(\"org.scoverage\" % \"sbt-scoverage\" % \"x.x.x\")\n```\n\nIf you are in an enterprise environment, and the above does not work, try:\n```scala\nlibraryDependencies += \"org.scoverage\" % \"sbt-scoverage_2.12_1.0\" % \"x.x.x\"\n```\n\n## Usage\n\nRun the tests with enabled coverage:\n```\nsbt clean coverage test\n```\nor if you have integration tests as well\n```\nsbt clean coverage it:test\n```\n\nThis instruments standard build output so remember to clean again with coverage disabled before publishing your build to avoid including instrumentation.\n\nTo enable coverage directly in your build, use:\n```scala\ncoverageEnabled := true\n```\n\nNote that this will result in code being always instrumented which is unlikely what you want.\n\n\nTo generate the coverage reports run\n```\nsbt coverageReport\n```\n\nCoverage reports will be in your\n`target/scala-\u003cscala-version\u003e/scoverage-report` directory.  There are\nHTML and XML reports. The XML is useful if you need to programatically\nuse the results, or if you're writing a tool.\n\n**NOTE**: If you're running the coverage reports from within an sbt\nconsole session (as opposed to one command per sbt launch), then the\n`coverage` command is sticky.  To turn it back off when you're done\nrunning reports, use the `coverageOff` command or reset\n`coverageEnabled` with `set coverageEnabled := false`.\n\n### Multi project reports\n\nBy default, scoverage will generate reports for each project\nseparately. You can merge them into an aggregated report by using the\nfollowing:\n\n```\n$ sbt coverageAggregate\n```\n\n**NOTE**: You do not need to run `coverageReport` before\n`coverageAggregate`; it aggregates over the sub-projects' coverage\ndata directly, not the report xml.\n\n### Exclude classes and packages and files\n\nYou can exclude classes from being considered for coverage measurement\nby providing semicolon-separated list of regular expressions.\n\n```scala\ncoverageExcludedPackages := \"\u003cempty\u003e;Reverse.*;.*AuthService.*;models\\\\.data\\\\..*\"\n```\n\nThe regular expressions are matched against the fully qualified class\nname, and must match the entire string to take effect.  Any matched\nclasses will not be instrumented or included in the coverage report.\n\nYou can also exclude files and file paths.\n\n```scala\ncoverageExcludedFiles := \".*\\\\/two\\\\/GoodCoverage;.*\\\\/three\\\\/.*\"\n```\n\n**NOTE**: The `.scala` file extension needs to be omitted from the\nfilename, if one is given.\n\n**NOTE**: These two options only work for Scala2, Scala 3.3.4+ and Scala 3.4.2+.\n\nYou can also mark sections of code with comments like:\n\n```scala\n  // $COVERAGE-OFF$Disabling highlighting by default until a workaround for https://issues.scala-lang.org/browse/SI-8596 is found\n  ...\n  // $COVERAGE-ON$\n```\n\nAny code between two such comments will not be instrumented or included in the\ncoverage report.\n\n**NOTE**: Comments exclusion works only for Scala2.\n\n### Minimum coverage\n\nBased on minimum coverage, you can fail the build with the following keys:\n\n```scala\ncoverageFailOnMinimum := true\ncoverageMinimumStmtTotal := 90\ncoverageMinimumBranchTotal := 90\ncoverageMinimumStmtPerPackage := 90\ncoverageMinimumBranchPerPackage := 85\ncoverageMinimumStmtPerFile := 85\ncoverageMinimumBranchPerFile := 80\n```\n\nThese settings will be enforced when the reports are generated.  If\nyou generate an aggregate report using `coverageAggregate` then these\nsettings will apply to that report.\n\n### Override Location for Coverage Data And Report\n\nIf desired, one could override the default location for generating the\nsbt report and data through setting `coverageDataDir`:\n\nExample in data-dir test:\n```scala\ncoverageDataDir := target.value / \"custom-test\"\n```\n\nCan also be set through the sbt set directive\n```scala\nset coverageDataDir := file(\"/tmp\")\n```\n\n## Trouble-shooting failing tests\n\nscoverage does a lot of file writing behind the scenes in order to\ntrack which statements have been executed.  If you are running into a\nscenario where your tests normally pass, but fail when scoverage is\nenabled, then the culprit can be one of the following:\n\n* timing issues on futures and other async operations, try upping the\n  timeouts by an order of magnitude.\n* tests are run in a sandbox mode (such as with\n  `java.security.PrivilegedAction\u003cT\u003e`), try running the tests outside\n  of the sandbox.\n\n## Example project\n\nTo see the plugin in action you can checkout the scoverage [samples][]\nproject.\n\n## Integrations\n\n### Codacy\n\n[Codacy][] integrates with your favorite coverage tool to provide an\nin-depth overlook of your project status. scoverage information can be\nintegrated into Codacy through the [codacy-coverage-reporter][].\n\n### Coveralls\n\nIf you have an open source project then you can publish the code\ncoverage metrics with [Coveralls][]. This plugin will integrate with\ncoveralls using the [sbt-coveralls][] plugin.\n\n### Codecov\n\nYou can also integrate with [Codecov][] by sending your reports there\nvia your CI. You can see an example in [codecov-example-scala][].\n\n### SonarQube\n\nIf you want to visually browse coverage reports then you can use the\n[SonarQube][] plugin. It allows you to review overall project\nstatement coverage as well as dig deeper into sub-modules, directories\nand source code files to see uncovered statements.  Statement coverage\nmeasurement can become an integral part of your team's continuous\nintegration process and a required quality standard.\n\n## Release Notes\n\nFor any information on releases and upgrading, please refer to the\n[release][] page.\n\n[Codacy]: https://www.codacy.com\n[Codecov]: https://about.codecov.io\n[Coveralls]: https://coveralls.io\n[SonarQube]: https://github.com/RadoBuransky/sonar-scoverage-plugin\n[codacy-coverage-reporter]: https://github.com/codacy/codacy-coverage-reporter\n[codecov-example-scala]: https://github.com/codecov/example-scala\n[gitter-badge]: https://img.shields.io/gitter/room/scoverage/scoverage.svg\n[gitter]: https://gitter.im/scoverage/scoverage\n[license-badge]: http://img.shields.io/:license-Apache%202-red.svg\n[license]: http://www.apache.org/licenses/LICENSE-2.0.txt\n[maven-badge]: https://index.scala-lang.org/scoverage/sbt-scoverage/sbt-scoverage/latest.svg\n[maven]: https://search.maven.org/artifact/org.scoverage/sbt-scoverage\n[release]: https://github.com/scoverage/sbt-scoverage/releases\n[samples]: https://github.com/scoverage/sbt-scoverage-samples\n[sbt-coveralls]: https://github.com/scoverage/sbt-coveralls\n[scoverage]: https://github.com/scoverage/scalac-scoverage-plugin\n","funding_links":[],"categories":["Table of Contents","Sbt plugins","TEST \u0026 QA"],"sub_categories":["Sbt plugins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscoverage%2Fsbt-scoverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscoverage%2Fsbt-scoverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscoverage%2Fsbt-scoverage/lists"}