Skip to content

Commit

Permalink
Do not overwrite junit5 test config (#712)
Browse files Browse the repository at this point in the history
Do not overwrite user provided test configure when using junit5
  • Loading branch information
ferozco authored and bulldozer-bot[bot] committed Jul 30, 2019
1 parent e03c723 commit b2d9acf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-712.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Do not overwrite user provided test configure when using junit5
links:
- https://github.com/palantir/gradle-baseline/pull/712
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.testing.Test;
import org.gradle.api.tasks.testing.TestFrameworkOptions;
import org.gradle.api.tasks.testing.junitplatform.JUnitPlatformOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -86,7 +88,10 @@ private boolean isJunitJupiter(Dependency dep) {
}

private void enableJunit5ForTestTask(Test task) {
task.useJUnitPlatform();
TestFrameworkOptions options = task.getOptions();
if (!(options instanceof JUnitPlatformOptions)) {
task.useJUnitPlatform();
}

task.systemProperty("junit.platform.output.capture.stdout", "true");
task.systemProperty("junit.platform.output.capture.stderr", "true");
Expand Down

0 comments on commit b2d9acf

Please sign in to comment.