Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scoverage/scalac-scoverage-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.7
Choose a base ref
...
head repository: scoverage/scalac-scoverage-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.10
Choose a head ref

Commits on Oct 18, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e9dde4 View commit details

Commits on Oct 20, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f880769 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9b046c3 View commit details

Commits on Oct 22, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4089831 View commit details

Commits on Nov 1, 2022

  1. Bump jsdom from 20.0.0 to 20.0.2 (#516)

    Bumps [jsdom](https://github.com/jsdom/jsdom) from 20.0.0 to 20.0.2.
    - [Release notes](https://github.com/jsdom/jsdom/releases)
    - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
    - [Commits](jsdom/jsdom@20.0.0...20.0.2)
    
    ---
    updated-dependencies:
    - dependency-name: jsdom
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 1, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5d8c898 View commit details

Commits on Nov 5, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bc0ed24 View commit details

Commits on Nov 15, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0ea965b View commit details

Commits on Nov 25, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    40f8af5 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cad6f2e View commit details

Commits on Dec 1, 2022

  1. Bump jsdom from 20.0.2 to 20.0.3 (#526)

    Bumps [jsdom](https://github.com/jsdom/jsdom) from 20.0.2 to 20.0.3.
    - [Release notes](https://github.com/jsdom/jsdom/releases)
    - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
    - [Commits](jsdom/jsdom@20.0.2...20.0.3)
    
    ---
    updated-dependencies:
    - dependency-name: jsdom
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 1, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    67166cd View commit details

Commits on Jan 26, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b653a17 View commit details

Commits on Jan 28, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c85ccc3 View commit details

Commits on Jan 30, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e81abc1 View commit details

Commits on Feb 1, 2023

  1. Bump jsdom from 20.0.3 to 21.1.0 (#533)

    Bumps [jsdom](https://github.com/jsdom/jsdom) from 20.0.3 to 21.1.0.
    - [Release notes](https://github.com/jsdom/jsdom/releases)
    - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
    - [Commits](jsdom/jsdom@20.0.3...21.1.0)
    
    ---
    updated-dependencies:
    - dependency-name: jsdom
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 1, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ea602c7 View commit details

Commits on Feb 9, 2023

  1. Handle branches in anonymous function pattern matching (#534)

    * Handle branches in anonymous function pattern matching
    
    * Handle canbuildfrom
    jrglee authored Feb 9, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    068e41d View commit details

Commits on Feb 27, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6c3cd69 View commit details

Commits on Mar 10, 2023

  1. fix: ignore lazy definition generated from by-name implicits (#536)

    Preamble:
    
    by-name implicit parameters used for shapeless magic and were
    introduced in SIP-31 (available from 2.13+):
    https://docs.scala-lang.org/sips/byname-implicits.html
    
    Using scoverage with such code may result in the following warning from
    the plugin:
    
    [warn] Could not instrument [Select/value rec$1].
    
    Originally discovered by using scoverage with the code that derives
    typeclass instances using kittens library:
    
    case class Bar()
    case class Foo(bars: List[Bar])
    object Foo {
      implicit eq: cats.Eq[Foo] = cats.derived.semiauto.eq
    }
    
    Solution:
    
    Ignore LazyDefns$1.rec$1 from instrumentation like other synthetic code
    
    Other changes:
    
    It was necessary to disable position validation phase for the test case
    that reproduces the issue because the code generated by scala compiler
    fails such validation. It could be also checked outside testing
    environment by manually setting -Yvalidate-pos:typer option to the
    compiler. Not sure whether it's expected compiler behavior or not
    danielleontiev authored Mar 10, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8dd2df4 View commit details

Commits on Mar 29, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4bfc931 View commit details

Commits on Apr 3, 2023

  1. Bump jsdom from 21.1.0 to 21.1.1 (#540)

    Bumps [jsdom](https://github.com/jsdom/jsdom) from 21.1.0 to 21.1.1.
    - [Release notes](https://github.com/jsdom/jsdom/releases)
    - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
    - [Commits](jsdom/jsdom@21.1.0...21.1.1)
    
    ---
    updated-dependencies:
    - dependency-name: jsdom
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 3, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4a144d2 View commit details

Commits on Apr 8, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a040f74 View commit details

Commits on Apr 10, 2023

  1. Update nscplugin, sbt-scala-native, ... to 0.4.12 (#538)

    * Update nscplugin, sbt-scala-native, ... to 0.4.12
    
    * Revert commit(s) 647c009
    
    * Update nscplugin, sbt-scala-native, ... to 0.4.12
    scala-steward authored Apr 10, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c2d7358 View commit details

Commits on Apr 11, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    15c260a View commit details

Commits on Apr 18, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d271929 View commit details

Commits on May 3, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d39c030 View commit details

Commits on Jun 2, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    360b55f View commit details
  2. Bump jsdom from 21.1.1 to 22.1.0 (#549)

    Bumps [jsdom](https://github.com/jsdom/jsdom) from 21.1.1 to 22.1.0.
    - [Release notes](https://github.com/jsdom/jsdom/releases)
    - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
    - [Commits](jsdom/jsdom@21.1.1...22.1.0)
    
    ---
    updated-dependencies:
    - dependency-name: jsdom
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jun 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    61a59aa View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a794bd5 View commit details
  4. chore: add support for 2.12.18 (#550)

    closes #548
    ckipp01 authored Jun 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    927a495 View commit details

Commits on Jun 3, 2023

  1. chore: add support for 2.13.11 (#553)

    closes #551
    ckipp01 authored Jun 3, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8612d70 View commit details
  2. chore: drop support for * < 2.13.5 for 2.13 (#554)

    Mainly because semanticdb has started dropping support as well.
    ckipp01 authored Jun 3, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    23e621f View commit details
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -19,12 +19,12 @@ jobs:
os: [ 'ubuntu-latest', 'windows-latest' ]
java: ['8', '17']
scala: [
{ version: '2.12.18' },
{ version: '2.12.17' },
{ version: '2.12.16' },
{ version: '2.12.15' },
{ version: '2.13.11' },
{ version: '2.13.10' },
{ version: '2.13.9' },
{ version: '2.13.8' },
{ version: '2.13.9' }
]
steps:
- name: checkout the repo
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*.log

# Build Server Protocol
.bsp/

# SBT specific
target/
project/boot/
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.5.9"
version = "3.7.4"
project.git = true
runner.dialect = "scala213"
assumeStandardLibraryStripMargin = true
6 changes: 1 addition & 5 deletions bin/test-release.sh
Original file line number Diff line number Diff line change
@@ -12,18 +12,14 @@ coursier fetch \
org.scoverage:scalac-scoverage-plugin_2.12.15:$version \
org.scoverage:scalac-scoverage-plugin_2.12.16:$version \
org.scoverage:scalac-scoverage-plugin_2.12.17:$version \
org.scoverage:scalac-scoverage-plugin_2.13.0:$version \
org.scoverage:scalac-scoverage-plugin_2.13.1:$version \
org.scoverage:scalac-scoverage-plugin_2.13.2:$version \
org.scoverage:scalac-scoverage-plugin_2.13.3:$version \
org.scoverage:scalac-scoverage-plugin_2.13.4:$version \
org.scoverage:scalac-scoverage-plugin_2.13.5:$version \
org.scoverage:scalac-scoverage-plugin_2.13.5:$version \
org.scoverage:scalac-scoverage-plugin_2.13.6:$version \
org.scoverage:scalac-scoverage-plugin_2.13.7:$version \
org.scoverage:scalac-scoverage-plugin_2.13.8:$version \
org.scoverage:scalac-scoverage-plugin_2.13.9:$version \
org.scoverage:scalac-scoverage-plugin_2.13.10:$version \
org.scoverage:scalac-scoverage-plugin_2.13.11:$version \
org.scoverage:scalac-scoverage-runtime_2.12:$version \
org.scoverage:scalac-scoverage-runtime_2.13:$version \
org.scoverage:scalac-scoverage-runtime_sjs1_2.12:$version \
26 changes: 15 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -2,13 +2,14 @@ import sbtcrossproject.CrossProject
import sbtcrossproject.CrossType

lazy val munitVersion = "0.7.29"
lazy val scalametaVersion = "4.6.0"
lazy val defaultScala212 = "2.12.17"
lazy val defaultScala213 = "2.13.10"
lazy val defaultScala3 = "3.1.3"
lazy val scalametaVersion = "4.7.8"
lazy val defaultScala212 = "2.12.18"
lazy val defaultScala213 = "2.13.11"
lazy val defaultScala3 = "3.3.0"
lazy val bin212 =
Seq(
defaultScala212,
"2.12.17",
"2.12.16",
"2.12.15",
"2.12.14",
@@ -20,16 +21,12 @@ lazy val bin212 =
lazy val bin213 =
Seq(
defaultScala213,
"2.13.10",
"2.13.9",
"2.13.8",
"2.13.7",
"2.13.6",
"2.13.5",
"2.13.4",
"2.13.3",
"2.13.2",
"2.13.1",
"2.13.0"
"2.13.5"
)

inThisBuild(
@@ -151,7 +148,14 @@ lazy val plugin =
sharedSettings
)
.settings(
Test / unmanagedSourceDirectories += (Test / sourceDirectory).value / "scala-2.12+"
Test / unmanagedSourceDirectories += (Test / sourceDirectory).value / "scala-2.12+",
Test / unmanagedSourceDirectories ++= {
val sourceDir = (Test / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => Seq(sourceDir / "scala-2.13+")
case _ => Seq.empty
}
}
)
.dependsOn(domain, reporter % "test->compile", serializer, buildInfo % Test)

627 changes: 175 additions & 452 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"jsdom": "^20.0.0"
"jsdom": "^22.1.0"
}
}
23 changes: 22 additions & 1 deletion plugin/src/main/scala/scoverage/ScoveragePlugin.scala
Original file line number Diff line number Diff line change
@@ -660,7 +660,20 @@ class ScoverageInstrumentationComponent(

// handle function bodies. This AST node corresponds to the following Scala code: vparams => body
case f: Function =>
treeCopy.Function(tree, f.vparams, process(f.body))
f.body match {
case b: Match =>
// anonymous function bodies with pattern matching needs to account for branches
treeCopy.Function(
tree,
f.vparams,
treeCopy.Match(
b,
b.selector,
transformCases(b.cases, branch = true)
)
)
case _ => treeCopy.Function(tree, f.vparams, process(f.body))
}

case _: Ident => tree

@@ -777,6 +790,14 @@ class ScoverageInstrumentationComponent(
*/
case s: Select if s.symbol.isLazy => tree

// Generated by compiler for lazy definitions involving
// by-name implicit parameters. More on that here:
// https://docs.scala-lang.org/sips/byname-implicits.html
//
// final <synthetic> val lazyDefns$1: LazyDefns$1 = new LazyDefns$1();
// lazyDefns$1.rec$1()
case s: Select if s.symbol.isSynthetic => tree

case s: Select =>
instrument(
treeCopy.Select(s, traverseApplication(s.qualifier), s.name),
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package scoverage

import munit.FunSuite

class Scala213PluginCoverageTest extends FunSuite with MacroSupport {

test(
"scoverage should ignore synthetic lazy definitions generated by compiler from by-name implicits"
) {
val compiler = ScoverageCompiler.noPositionValidation
compiler.compileCodeSnippet(
"""
|object test {
|
| trait Foo {
| def next: Foo
| }
|
| object Foo {
| implicit def foo(implicit rec: => Foo): Foo =
| new Foo { def next = rec }
| }
|
| val foo = implicitly[Foo]
|
|}
|
""".stripMargin
)
assert(!compiler.reporter.hasErrors)
assert(!compiler.reporter.hasWarnings)
}
}
38 changes: 32 additions & 6 deletions plugin/src/test/scala/scoverage/PluginCoverageTest.scala
Original file line number Diff line number Diff line change
@@ -130,15 +130,41 @@ class PluginCoverageTest extends FunSuite with MacroSupport {
assert(!compiler.reporter.hasErrors)
// should instrument:
// the if clause,
// thenp block,
// thenp literal "1",
// elsep block,
// elsep literal "2",
// then block,
// then literal "1",
// else block,
// else literal "2",
// case block "yes" literal
// skip case block "yes" literal
compiler.assertNMeasuredStatements(7)
}

test(
"scoverage should instrument anonymous function with pattern matching body"
) {
val compiler = ScoverageCompiler.default
compiler.compileCodeSnippet(
""" object A {
| def foo(a: List[Option[Int]]) = a.map {
| case Some(value) => value + 1
| case None => 0
| }
|} """.stripMargin
)
assert(!compiler.reporter.hasErrors)
// should instrument:
// the def method entry,
// case Some,
// case block expression
// case none,
// case block literal "0"

// account for canbuildfrom statement
val expectedStatementsCount =
if (ScoverageCompiler.ShortScalaVersion < "2.13") 6 else 5
compiler.assertNMeasuredStatements(expectedStatementsCount)
}

// https://github.com/scoverage/sbt-scoverage/issues/16
test(
"scoverage should instrument for-loops but not the generated scaffolding"
@@ -246,9 +272,9 @@ class PluginCoverageTest extends FunSuite with MacroSupport {

assert(!compiler.reporter.hasErrors)
assert(!compiler.reporter.hasWarnings)
// should have 4 profiled statements: the outer apply, the true, the a < b, the false
// should have 7 profiled statements: the outer apply, and three pairs of case patterns & blocks
// we are testing that we don't instrument the tuple2 call used here
compiler.assertNMeasuredStatements(4)
compiler.assertNMeasuredStatements(7)
}

test("scoverage should instrument all case statements in an explicit match") {
15 changes: 11 additions & 4 deletions plugin/src/test/scala/scoverage/ScoverageCompiler.scala
Original file line number Diff line number Diff line change
@@ -57,12 +57,17 @@ private[scoverage] object ScoverageCompiler {

def default: ScoverageCompiler = {
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new ScoverageCompiler(settings, reporter)
new ScoverageCompiler(settings, reporter, validatePositions = true)
}

def noPositionValidation: ScoverageCompiler = {
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new ScoverageCompiler(settings, reporter, validatePositions = false)
}

def defaultJS: ScoverageCompiler = {
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(jsSettings)
new ScoverageCompiler(jsSettings, reporter)
new ScoverageCompiler(jsSettings, reporter, validatePositions = true)
}

def locationCompiler: LocationCompiler = {
@@ -152,7 +157,8 @@ private[scoverage] object ScoverageCompiler {

class ScoverageCompiler(
settings: scala.tools.nsc.Settings,
rep: scala.tools.nsc.reporters.Reporter
rep: scala.tools.nsc.reporters.Reporter,
validatePositions: Boolean
) extends scala.tools.nsc.Global(settings, rep) {

def addToClassPath(file: File): Unit = {
@@ -268,7 +274,8 @@ class ScoverageCompiler(

override def computeInternalPhases(): Unit = {
super.computeInternalPhases()
addToPhasesSet(validator, "scoverage validator")
if (validatePositions)
addToPhasesSet(validator, "scoverage validator")
addToPhasesSet(
instrumentationComponent,
"scoverage instrumentationComponent"
12 changes: 6 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.33")

Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ class CoberturaXmlWriter(
val file = new File(outputDir, "cobertura.xml")
IOUtils.writeToFile(
file,
"<?xml version=\"1.0\"?>\n<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/coverage-04.dtd\">\n" +
"<?xml version=\"1.0\"?>\n<!DOCTYPE coverage SYSTEM \"https://cobertura.sourceforge.net/xml/coverage-04.dtd\">\n" +
new PrettyPrinter(120, 4).format(xml(coverage)),
sourceEncoding
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<!DOCTYPE coverage SYSTEM "https://cobertura.sourceforge.net/xml/coverage-04.dtd">

<coverage line-rate="0.9" branch-rate="0.75" version="1.9" timestamp="1187350905008">
<sources>
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ class CoberturaXmlWriterTest extends FunSuite {
)
}

test("cobertura output validates".ignore) {
test("cobertura output validates") {

val dir = tempDir()

@@ -298,8 +298,6 @@ class CoberturaXmlWriterTest extends FunSuite {
writer.write(coverage)

val domFactory = DocumentBuilderFactory.newInstance()
// TODO set validating here is no longer working as of 2.13.10. Not fully sure why but I don't use
// cobertura, so if someone wants to fix this, please do. I'll move forward with this not to block the release.
domFactory.setValidating(true)
val builder = domFactory.newDocumentBuilder()
builder.setErrorHandler(new ErrorHandler() {