Skip to content

Commit 7d6152a

Browse files
committed
Add exception logging on failed tests
1 parent 946a094 commit 7d6152a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@ tasks.withType(Test) {
3939

4040
}
4141
afterTest { descriptor, result ->
42+
String indent = ' '
4243
def indicator = ANSI_WHITE
4344

4445
if (result.failedTestCount > 0) indicator = ANSI_RED + X_MARK
4546
else if (result.skippedTestCount > 0) indicator = ANSI_YELLOW + NEUTRAL_FACE
4647
else indicator = ANSI_GREEN + CHECK_MARK
4748

48-
out.println(' ' + indicator + ANSI_RESET + " " + descriptor.name);
49-
50-
if (result.failedTestCount > 0) { out.println(' ') }
49+
out.println(indent + indicator + ANSI_RESET + " " + descriptor.name);
5150

51+
if (result.failedTestCount > 0) {
52+
String exceptions = result.getException().toString()
53+
out.println(indent + exceptions.split("\\n").join("\n" + indent))
54+
}
5255
}
5356

5457
afterSuite { desc, result ->

0 commit comments

Comments
 (0)