[Gradle, JS] Ignore stdout for mocha dry run

^KT-61992 fixed
This commit is contained in:
Ilya Goncharov
2023-10-19 09:46:01 +00:00
committed by Space Team
parent a68a2409d3
commit 5df8ac4d1a
2 changed files with 17 additions and 0 deletions
@@ -1298,6 +1298,17 @@ class Kotlin2JsIrGradlePluginIT : KGPBaseTest() {
)
buildAndFail("nodeTest") {
assertTasksFailed(":nodeTest")
assertOutputContains("Cannot find module 'foo'")
}
}
}
@DisplayName("mocha has no output during dry run")
@GradleTest
fun testMochaHasNoDryRunOutput(gradleVersion: GradleVersion) {
project("kotlin-js-nodejs-project", gradleVersion) {
build("nodeTest") {
assertOutputDoesNotContain("0 passing")
}
}
}
@@ -59,6 +59,12 @@ class TCServiceMessagesTestExecutor(
if (spec.dryRunArgs != null) {
val exec = execHandleFactory.newExec()
spec.forkOptions.copyTo(exec)
// get rid of redundant output during dry-run
exec.standardOutput = object : OutputStream() {
override fun write(b: Int) {
// do nothing
}
}
exec.args = spec.dryRunArgs
execHandle = exec.build()