package scoverage
- Alphabetic
- Public
- Protected
Type Members
- trait ScoverageModule extends Module with ScalaModule
Adds targets to a mill.scalalib.ScalaModule to create test coverage reports.
Adds targets to a mill.scalalib.ScalaModule to create test coverage reports.
This module allows you to generate code coverage reports for Scala projects with Scoverage via the scoverage compiler plugin.
To declare a module for which you want to generate coverage reports you can Extends the
mill.contrib.scoverage.ScoverageModule
trait when defining your Module. Additionally, you must define a submodule that extends theScoverageTests
trait that belongs to your instance ofScoverageModule
.// You have to replace VERSION import $ivy.`com.lihaoyi::mill-contrib-buildinfo:VERSION` import mill.contrib.scoverage.ScoverageModule Object foo extends ScoverageModule { def scalaVersion = "2.12.9" def scoverageVersion = "1.4.0" object test extends ScoverageTests { def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.0.5") def testFrameworks = Seq("org.scalatest.tools.Framework") } }
In addition to the normal tasks available to your Scala module, Scoverage Modules introduce a few new tasks and changes the behavior of an existing one.
- mill foo.scoverage.compile # compiles your module with test instrumentation # (you don't have to run this manually, running the test task will force its invocation)
- mill foo.test # tests your project and collects metrics on code coverage - mill foo.scoverage.htmlReport # uses the metrics collected by a previous test run to generate a coverage report in html format - mill foo.scoverage.xmlReport # uses the metrics collected by a previous test run to generate a coverage report in xml format
The measurement data by default is available at
out/foo/scoverage/dataDir.dest/
, the html report is saved inout/foo/scoverage/htmlReport.dest/
, and the xml report is saved inout/foo/scoverage/xmlReport.dest/
.- Annotations
- @Scaladoc()
- trait ScoverageReport extends define.Module
Allows the aggregation of coverage reports across multi-module projects.
Allows the aggregation of coverage reports across multi-module projects.
Once tests have been run across all modules, this collects reports from all modules that extend mill.contrib.scoverage.ScoverageModule. Simply define a module that extends mill.contrib.scoverage.ScoverageReport and call one of the available "report all" functions.
For example, define the following
scoverage
module and use the relevant reporting option to generate a report:object scoverage extends ScoverageReport { override def scalaVersion = "<scala-version>" override def scoverageVersion = "<scoverage-version>" }
- mill .test # run tests for all modules - mill scoverage.htmlReportAll # generates report in html format for all modules - mill scoverage.xmlReportAll # generates report in xml format for all modules - mill scoverage.consoleReportAll # reports to the console for all modules
The aggregated report will be available at either
out/scoverage/htmlReportAll.dest/
for html reports orout/scoverage/xmlReportAll.dest/
for xml reports.- Annotations
- @Scaladoc()
- class ScoverageReportWorker extends AutoCloseable
Value Members
- object ScoverageReportWorker extends ExternalModule