From 8d11f3df95966d7f513b6291f0b2e1f604fd6f83 Mon Sep 17 00:00:00 2001 From: Evgeny Naumenko Date: Sun, 26 May 2024 19:06:00 +0300 Subject: [PATCH] #309 make all tests debuggable --- .../MultiProjectReportCachingSpec.groovy | 22 ++++++++++--------- .../com/github/jk1/license/PluginSpec.groovy | 15 +++++++------ .../license/check/CheckLicenseTaskSpec.groovy | 20 ++++++++++------- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/test/groovy/com/github/jk1/license/MultiProjectReportCachingSpec.groovy b/src/test/groovy/com/github/jk1/license/MultiProjectReportCachingSpec.groovy index 767e569e..e3f6b02e 100644 --- a/src/test/groovy/com/github/jk1/license/MultiProjectReportCachingSpec.groovy +++ b/src/test/groovy/com/github/jk1/license/MultiProjectReportCachingSpec.groovy @@ -75,11 +75,7 @@ class MultiProjectReportCachingSpec extends Specification { """ - BuildResult result = GradleRunner.create() - .withPluginClasspath() - .withProjectDir(testProjectDir) - .withArguments('--build-cache', "generateLicenseReport") - .build() + BuildResult result = runBuild() then: result.task(':generateLicenseReport').outcome == TaskOutcome.SUCCESS @@ -91,13 +87,19 @@ class MultiProjectReportCachingSpec extends Specification { } """ - result = GradleRunner.create() - .withPluginClasspath() - .withProjectDir(testProjectDir) - .withArguments('--build-cache', "generateLicenseReport") - .build() + result = runBuild() then: result.task(':generateLicenseReport').outcome == TaskOutcome.SUCCESS } + + private BuildResult runBuild() { + return GradleRunner.create() + .withPluginClasspath() + .withProjectDir(testProjectDir) + .withArguments('--build-cache', "generateLicenseReport") + .withDebug(true) + .forwardOutput() + .build() + } } diff --git a/src/test/groovy/com/github/jk1/license/PluginSpec.groovy b/src/test/groovy/com/github/jk1/license/PluginSpec.groovy index 80344fb3..4106aa5e 100644 --- a/src/test/groovy/com/github/jk1/license/PluginSpec.groovy +++ b/src/test/groovy/com/github/jk1/license/PluginSpec.groovy @@ -28,7 +28,7 @@ import static com.github.jk1.license.AbstractGradleRunnerFunctionalSpec.fixPathF class PluginSpec extends Specification { private final static def supportedGradleVersions = ["7.6.1", "8.1.1"] - private final static def unsupportedGradleVersions = [ "5.6", "6.8.2" ] + private final static def unsupportedGradleVersions = ["5.6", "6.8.2"] @TempDir File testProjectDir @@ -142,11 +142,12 @@ class PluginSpec extends Specification { private def runGradle(String gradleVersion) { GradleRunner.create() - .withGradleVersion(gradleVersion) - .withProjectDir(testProjectDir) - .withArguments("generateLicenseReport", "--info", "--stacktrace") - .withPluginClasspath() - .forwardOutput() - .build() + .withGradleVersion(gradleVersion) + .withProjectDir(testProjectDir) + .withArguments("generateLicenseReport", "--info", "--stacktrace") + .withPluginClasspath() + .withDebug(true) + .forwardOutput() + .build() } } diff --git a/src/test/groovy/com/github/jk1/license/check/CheckLicenseTaskSpec.groovy b/src/test/groovy/com/github/jk1/license/check/CheckLicenseTaskSpec.groovy index d257063a..dec605de 100644 --- a/src/test/groovy/com/github/jk1/license/check/CheckLicenseTaskSpec.groovy +++ b/src/test/groovy/com/github/jk1/license/check/CheckLicenseTaskSpec.groovy @@ -33,18 +33,22 @@ class CheckLicenseTaskSpec extends Specification { BuildResult result(String[] arguments) { return GradleRunner.create() - .withPluginClasspath() - .withProjectDir(testProjectDir) - .withArguments(arguments) - .build() + .withPluginClasspath() + .withProjectDir(testProjectDir) + .withArguments(arguments) + .withDebug(true) + .forwardOutput() + .build() } BuildResult failResult(String[] arguments) { return GradleRunner.create() - .withPluginClasspath() - .withProjectDir(testProjectDir) - .withArguments(arguments) - .buildAndFail() + .withPluginClasspath() + .withProjectDir(testProjectDir) + .withArguments(arguments) + .withDebug(true) + .forwardOutput() + .buildAndFail() } def setup() {