From 27dfc2cdeb34771400db294126a846c812f07162 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 27 Apr 2021 08:34:14 +0300 Subject: [PATCH] Make test failures more prominent in terminal output in continuous testing --- .../dev/testing/TestConsoleHandler.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java index 1b247acd40a43..79bd24ad4bf80 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java @@ -166,12 +166,8 @@ public void runComplete(TestRunResults results) { + " were skipped. Tests took " + (results.getTotalTime()) + "ms." + "\u001b[0m"; } else { - StringBuilder sb = new StringBuilder( - "\u001B[91mTest run failed, " + methodCount.get() + " tests were run, " - + results.getCurrentFailing().size() - + " failed, " - + skipped.get() - + " were skipped. Tests took " + results.getTotalTime() + "ms"); + int failedTestsNum = results.getCurrentFailing().size(); + boolean hasFailingTests = failedTestsNum > 0; for (Map.Entry classEntry : results.getCurrentFailing().entrySet()) { for (TestResult test : classEntry.getValue().getFailing()) { log.error( @@ -179,7 +175,12 @@ public void runComplete(TestRunResults results) { test.getTestExecutionResult().getThrowable().get()); } } - lastStatus = sb.toString() + "\u001b[0m"; + String output = String.format("Test run failed, %d tests were run, ", methodCount.get()) + + String.format("%s%d failed%s, ", + hasFailingTests ? "\u001B[1m" : "", failedTestsNum, + hasFailingTests ? "\u001B[2m" : "") + + String.format("%d were skipped. Tests took %dms", skipped.get(), results.getTotalTime()); + lastStatus = "\u001B[91m" + output + "\u001b[0m"; } //this will re-print when using the basic console promptHandler.setPrompt(RUNNING_PROMPT);