Skip to content

Commit

Permalink
[SUREFIRE-2124] Avoid creating unnecessary target files for pom projects
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Jun 27, 2024
1 parent d626ced commit 4eaf1f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,11 @@ protected int getRerunFailingTestsCount() {
@SuppressWarnings("unchecked")
protected void handleSummary(RunResult summary, Exception firstForkException)
throws MojoExecutionException, MojoFailureException {
File summaryFile = getSummaryFile();
if (!summaryFile.getParentFile().isDirectory()) {
//noinspection ResultOfMethodCallIgnored
summaryFile.getParentFile().mkdirs();
}

try {
Object token = getPluginContext().get(FAILSAFE_IN_PROGRESS_CONTEXT_KEY);
writeSummary(summary, summaryFile, token != null);
if (!summary.isNoTestsRun()) {
writeSummary(summary, getSummaryFile(), token != null);
}
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public RunResult(
this.errors = errors;
this.failures = failures;
this.skipped = skipped;
this.flakes = flakes;
this.failure = failure;
this.timeout = timeout;
this.flakes = flakes;
}

private static String getStackTrace(Exception e) {
Expand Down Expand Up @@ -174,6 +174,10 @@ public static RunResult noTestsRun() {
return new RunResult(0, 0, 0, 0);
}

public boolean isNoTestsRun() {
return completedCount == 0 && errors == 0 && skipped == 0 && flakes == 0 && failure == null && !timeout;
}

@Override
@SuppressWarnings("RedundantIfStatement")
public boolean equals(Object o) {
Expand Down

0 comments on commit 4eaf1f4

Please # to comment.