File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,26 @@ subprojects {
263
263
}
264
264
}
265
265
task run(dependsOn : createdTasks)
266
+
267
+ /* Store test output in $projectName/tests
268
+ JUnit 5's junitPlatformTest runs as a "javaExec" rather than a "test",
269
+ so we can't hook into the before/after test behavior.
270
+ */
271
+ tasks. findByPath(" :$name :junitPlatformTest" ). configure{
272
+ File testDir = new File (project. name + " /tests" )
273
+ if ( testDir. exists() ) {
274
+ File outFile = new File (testDir, ' report.txt' )
275
+ doFirst{
276
+ standardOutput = new TeeOutputStream (new FileOutputStream (outFile, true ), System . out)
277
+ }
278
+ doLast {
279
+ if (outFile. size() == 0 )
280
+ outFile. delete()
281
+ else if (outFile. text. contains(" 0 tests found" ))
282
+ outFile. delete()
283
+ }
284
+ }
285
+ }
266
286
}
267
287
268
288
project(' :validating' ) {
You can’t perform that action at this time.
0 commit comments