Skip to content

Commit

Permalink
#309 make all tests debuggable
Browse files Browse the repository at this point in the history
  • Loading branch information
jk1 committed May 26, 2024
1 parent 6fbd80e commit 8d11f3d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
}
15 changes: 8 additions & 7 deletions src/test/groovy/com/github/jk1/license/PluginSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 8d11f3d

Please sign in to comment.