SysProp sbt.testing.legacyreport: fix integration tests, JUnitXmlTestsListener backward binary compatibility

This commit is contained in:
Jannik Theiß 2020-01-08 15:29:48 +01:00
parent cea516175f
commit af245d2494
3 changed files with 10 additions and 9 deletions

View File

@ -33,8 +33,8 @@ object JUnitXmlReportPlugin extends AutoPlugin {
Seq( Seq(
testListeners += new JUnitXmlTestsListener( testListeners += new JUnitXmlTestsListener(
target.value.getAbsolutePath, target.value.getAbsolutePath,
streams.value.log, SysProp.legacyTestReport,
SysProp.legacyTestReport streams.value.log
) )
) )
} }

View File

@ -5,11 +5,11 @@ import Defaults._
val checkReport = taskKey[Unit]("Check the test reports") val checkReport = taskKey[Unit]("Check the test reports")
val checkNoReport = taskKey[Unit]("Check that no reports are present") val checkNoReport = taskKey[Unit]("Check that no reports are present")
val oneSecondReportFile = "target/test-reports/a.pkg.OneSecondTest.xml" val oneSecondReportFile = "target/test-reports/TEST-a.pkg.OneSecondTest.xml"
val failingReportFile = "target/test-reports/another.pkg.FailingTest.xml" val failingReportFile = "target/test-reports/TEST-another.pkg.FailingTest.xml"
val flatSuiteReportFile = "target/test-reports/my.scalatest.MyFlatSuite.xml" val flatSuiteReportFile = "target/test-reports/TEST-my.scalatest.MyFlatSuite.xml"
val nestedSuitesReportFile = "target/test-reports/my.scalatest.MyNestedSuites.xml" val nestedSuitesReportFile = "target/test-reports/TEST-my.scalatest.MyNestedSuites.xml"
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
val junitinterface = "com.novocode" % "junit-interface" % "0.11" val junitinterface = "com.novocode" % "junit-interface" % "0.11"

View File

@ -33,10 +33,11 @@ import sbt.protocol.testing.TestResult
* report format. * report format.
* @param outputDir path to the dir in which a folder with results is generated * @param outputDir path to the dir in which a folder with results is generated
*/ */
class JUnitXmlTestsListener(val outputDir: String, logger: Logger, legacyTestReport: Boolean) class JUnitXmlTestsListener(val outputDir: String, legacyTestReport: Boolean, logger: Logger)
extends TestsListener { extends TestsListener {
// This constructor is for binary compatibility with older versions of sbt. // These constructors are for binary compatibility with older versions of sbt.
def this(outputDir: String) = this(outputDir, null, false) def this(outputDir: String, logger: Logger) = this(outputDir, false, logger)
def this(outputDir: String) = this(outputDir, false, null)
/**Current hostname so we know which machine executed the tests*/ /**Current hostname so we know which machine executed the tests*/
val hostname: String = { val hostname: String = {