sbt / sbt-jacoco

an sbt plugin for JaCoCo Code Coverage
https://scala-sbt.org/sbt-jacoco/
Eclipse Public License 1.0
123 stars 67 forks source link

Conditional Merge of integration test set to false does not appear to be working #36

Open rmmeans opened 9 years ago

rmmeans commented 9 years ago

I'm having problems getting conditional merge on the intergration tests set to false - I would like to maintain two separate reports.

Our build.sbt looks something like this (a few app specifics removed):

import play.PlayImport._
import play.PlayScala
import de.johoop.jacoco4sbt._
import JacocoPlugin._

name := "my-awesome-app"

scalaVersion := "2.11.2"

unmanagedSourceDirectories in IntegrationTest <<= (baseDirectory in IntegrationTest)(base =>  Seq(base / "test-integration"))

lazy val root = (project in file(".")).enablePlugins(PlayScala).configs(IntegrationTest).settings(
  Defaults.itSettings : _*
)

resolvers ++= Seq(
  "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
)

//----------------------------------------
// Setup Jacoco test coverage.
// Invocation: jacoco:cover
// Results: target/jacoco/html/index.html
// See: https://github.com/sbt/jacoco4sbt
//      project/plugins.sbt
//----------------------------------------
jacoco.settings

parallelExecution      in jacoco.Config := false

jacoco.outputDirectory in jacoco.Config := file("target/jacoco")

jacoco.reportFormats   in jacoco.Config := Seq(XMLReport("utf-8"), ScalaHTMLReport(withBranchCoverage = true))

jacoco.includes        in jacoco.Config := Seq("*controllers*", "*actors*", "*helpers*", "*model*")

jacoco.excludes        in jacoco.Config := Seq("controllers*routes*", "controllers*Reverse*", "controllers*javascript*", "controllers*ref*")

//
// Integration tests once
//

itJacoco.settings

parallelExecution        in itJacoco.Config := false

itJacoco.mergeReports    in itJacoco.Config := false

itJacoco.outputDirectory in itJacoco.Config := file("target/it-jacoco")

itJacoco.reportFormats   in itJacoco.Config := Seq(XMLReport("utf-8"), ScalaHTMLReport(withBranchCoverage = true))

itJacoco.includes        in itJacoco.Config := Seq("*controllers*", "*actors*", "*helpers*", "*model*")

itJacoco.excludes        in itJacoco.Config := Seq("controllers*routes*", "controllers*Reverse*", "controllers*javascript*", "controllers*ref*")

Note that I have the mergeReports of the itJacoco configuration turned off.

However, when I run a command such as this: sbt clean-files clean compile jacoco:cover it-jacoco:cover
all the tests run, but in my output directory of the target/it-jacoco folder I have a jacoco.exec and a jacoco-merged.exec, and the report html files that are built are built from the merged results.

I am using:

UnknownNPC commented 6 years ago

@rmmeans sounds strange, but could you try to set false flag in next way: itJacoco.mergeReports := false, instead of itJacoco.mergeReports in itJacoco.Config := false

rmmeans commented 6 years ago

I no longer use jacoco, so unless this is of value to someone else, feel free to close.