diff options
author | Nik Vanderhoof <nikolasrvanderhoof@gmail.com> | 2019-05-18 23:22:13 -0400 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-05-19 11:22:13 +0800 |
commit | c4a65baab92890d2d5682329a87469bec605fe5d (patch) | |
tree | 1d8caffb159d847e7cafa211572204164b3eabc2 /docs | |
parent | 6c86609a6474e952e3d4972852f032af944631dc (diff) | |
download | mill-c4a65baab92890d2d5682329a87469bec605fe5d.tar.gz mill-c4a65baab92890d2d5682329a87469bec605fe5d.tar.bz2 mill-c4a65baab92890d2d5682329a87469bec605fe5d.zip |
Add support for Scoverage (#571)
* Add initial work for ScoverageModule
* style: Move package scoverage from lib to contrib
Suggested by @lefou
> I think, it would be better to add under `mill.contrib.scoverage`.
Pull request: #571
* Initial changes to non-hardcoded scoverage version
* Using task context api to specify dataDir
Now measurement data will be written to:
PROJECT_ROOT/out/MODULE/scoverage/data/
and the html report will be written to:
PROJECT_ROOT/out/MODULE/scoverage/data/htmlReport/
* Remove wild card imports in scoverage
Also remove scoverage dependency from build.sc
* Move htmlReport into worker
Based on what I've seen in
scalalib, scalajslib, scalanativelib, playlib, and twirllib modules.
Still need to add tests
* Add basic docs + tests for scoverage
I still am working on testing the actual generation of
reports.
* Use cross-module for scoverage worker
Now we can support multiple versions of scoverage
by adding them to the crossmodule list.
Also now running the local publish script succeeds.
* Add scoverage to ci tests
* Add detailed ScoverageModule documentation
* Test scoverage dataDir
* Remove <pre> tags in scaladoc
* Add scoverage dependency in less hacky way
* Modify scoverage tests to check classpaths
* Put docs in alphabetical order
* Test classpaths for scoverage runtime
* Remove abstract def test: ScoverageTests
* Construct classloader differently
* Revert "Construct classloader differently"
This reverts commit fccf9a94cc38fb9e2be58a9ff90b00b65f339db6.
* Revert "Construct classloader differently"
Also fixes unfound error in html report
This reverts commit fccf9a94cc38fb9e2be58a9ff90b00b65f339db6.
* Fix classpath for scoverage worker
Diffstat (limited to 'docs')
-rw-r--r-- | docs/pages/9 - Contrib Modules.md | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md index eca61be3..c3d4751a 100644 --- a/docs/pages/9 - Contrib Modules.md +++ b/docs/pages/9 - Contrib Modules.md @@ -543,6 +543,49 @@ object example extends ScalaPBModule { } ``` + +## Scoverage + +This module allows you to generate code coverage reports for Scala projects with +[Scoverage](https://github.com/scoverage) via the +[scalac-scoverage-plugin](https://github.com/scoverage/scalac-scoverage-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 the +`ScoverageTests` trait that belongs to your instance of `ScoverageModule`. + +```scala +// 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.11.8" + def scoverageVersion = "1.3.1" + + 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 +``` + +The measurement data is available at `out/foo/scoverage/data/`, +and the html report is saved in `out/foo/scoverage/htmlReport/`. + + ## TestNG Provides support for [TestNG](https://testng.org/doc/index.html). @@ -722,4 +765,3 @@ These imports will always be added to every template. You don't need to list th ### Example There's an [example project](https://github.com/lihaoyi/cask/tree/master/example/twirl) - |