Add test reporter for Kotlin/JS
This PR adds test reporter for Kotlin/JS. It is based on XUnit reporter provided by Mocha - XML will be generated anyway, irrespective of the TestModule.testReportXml option, because structured output is needed in order to be able to parse it.
So as a result it will be XML file + test result message, which can be seen in the tests.
Adding HTML reporter is not yet possible without using 3rd party packages, because the one provided OOTB by Mocha is not intended for CLI usage.
I also had to modify the Jvm.runSubprocess method, so it doesn't throw if exit code is not 0, but returns result. To comply with the old behavior, all the old call sites will just call getOrThrow on the result.
This change is needed, because if there is a test failure, node process will exit with code 1, but we still need to process and catching generic Exception is not an option (because maybe it is not because of the exit code).
Upd: Binary compatibility check now complains that Jvm.runSubprocess has a different return type, but I'm not sure if it should be a problem, because before it was simply returning Unit. But if it is a problem, I can introduce a new method instead.
Upd: Binary compatibility check now complains that Jvm.runSubprocess has a different return type, but I'm not sure if it should be a problem, because before it was simply returning Unit. But if it is a problem, I can introduce a new method instead.
Yes let's give the new method a new name to preserve binary compatibility. The old one returning : Unit can just call the new one and ignore the return value
Seems like some of the mill.kotlinlib.js.KotlinJSNodeRunTests tests are failing
Oh, yeah, indeed, thank for spotting it. I was thinking it was a flaky test from scalalib, but turns out not only it.
This is the case where type safety cannot be checked during the compile time, because Result.Failing is itself Exception.
Fixed now.