diff --git a/src/main/groovy/com/github/maiflai/ScalaTestAction.groovy b/src/main/groovy/com/github/maiflai/ScalaTestAction.groovy index c64d2fa..a7ecf82 100644 --- a/src/main/groovy/com/github/maiflai/ScalaTestAction.groovy +++ b/src/main/groovy/com/github/maiflai/ScalaTestAction.groovy @@ -5,6 +5,7 @@ import org.gradle.api.GradleException import org.gradle.api.internal.file.FileResolver import org.gradle.api.reporting.DirectoryReport import org.gradle.api.tasks.testing.Test +import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.util.PatternSet import org.gradle.logging.ConsoleRenderer @@ -102,14 +103,14 @@ class ScalaTestAction implements Action { static String exceptions(Test t) { if (t.testLogging.showExceptions) { - if (t.testLogging.showCauses) { - 'F' - } else { - 'S' + switch (t.testLogging.exceptionFormat) { + case TestExceptionFormat.FULL: + return 'F' + case TestExceptionFormat.SHORT: + return 'S' } - } else { - '' } + return '' } static String durations = 'D' diff --git a/src/main/groovy/com/github/maiflai/ScalaTestPlugin.groovy b/src/main/groovy/com/github/maiflai/ScalaTestPlugin.groovy index 9afa982..ff76ca5 100644 --- a/src/main/groovy/com/github/maiflai/ScalaTestPlugin.groovy +++ b/src/main/groovy/com/github/maiflai/ScalaTestPlugin.groovy @@ -5,6 +5,7 @@ import org.gradle.api.Project import org.gradle.api.plugins.JavaPlugin import org.gradle.api.plugins.scala.ScalaPlugin import org.gradle.api.tasks.testing.Test +import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.util.PatternSet @@ -26,7 +27,7 @@ class ScalaTestPlugin implements Plugin { new JacocoTestAction(), new ScalaTestAction() ] - test.testLogging.showCauses = false + test.testLogging.exceptionFormat = TestExceptionFormat.SHORT test.extensions.add(ScalaTestAction.TAGS, new PatternSet()) List suites = [] test.extensions.add(ScalaTestAction.SUITES, suites) diff --git a/src/test/groovy/com/github/maiflai/ScalaTestActionTest.groovy b/src/test/groovy/com/github/maiflai/ScalaTestActionTest.groovy index c43a3c5..387ecef 100644 --- a/src/test/groovy/com/github/maiflai/ScalaTestActionTest.groovy +++ b/src/test/groovy/com/github/maiflai/ScalaTestActionTest.groovy @@ -2,10 +2,10 @@ package com.github.maiflai import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.process.internal.JavaExecAction import org.gradle.testfixtures.ProjectBuilder -import org.hamcrest.CoreMatchers import org.hamcrest.Description import org.hamcrest.Matcher import org.hamcrest.TypeSafeMatcher @@ -82,6 +82,20 @@ class ScalaTestActionTest { assertThat(commandLine(test), hasOutput('oD')) } + @Test + public void fullStackTraces() throws Exception { + Task test = testTask() + test.testLogging.exceptionFormat = TestExceptionFormat.FULL + assertThat(commandLine(test), hasOutput('oDF')) + } + + @Test + public void shortStackTraces() throws Exception { + Task test = testTask() + test.testLogging.exceptionFormat = TestExceptionFormat.SHORT + assertThat(commandLine(test), hasOutput('oDS')) + } + @Test public void maxHeapSizeIsAdded() throws Exception { Task test = testTask()