rra/ilgonmic/KT-52221-dry-run-with-empty-nodejs
[Gradle, JS] Disable for wasm [Gradle, JS] Add test on mocha with dry run should report test state [Gradle, JS] When run in dry mode, we need special adapter which not run tests Merge-request: KT-MR-6205 Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com> ^KT-52221 fixed
This commit is contained in:
+20
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.gradle.util.normalizePath
|
|||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.condition.DisabledIf
|
import org.junit.jupiter.api.condition.DisabledIf
|
||||||
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
@@ -1150,6 +1151,25 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
|
|||||||
assertOutputDoesNotContain("##teamcity[")
|
assertOutputDoesNotContain("##teamcity[")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
projectPath.resolve("src/test/kotlin/Tests.kt").appendText(
|
||||||
|
"\n" + """
|
||||||
|
|class Tests3 {
|
||||||
|
| @Test
|
||||||
|
| fun testHello() {
|
||||||
|
| throw IllegalArgumentException("foo")
|
||||||
|
| }
|
||||||
|
|}
|
||||||
|
""".trimMargin()
|
||||||
|
)
|
||||||
|
buildAndFail("nodeTest") {
|
||||||
|
assertTasksFailed(":nodeTest")
|
||||||
|
|
||||||
|
assertTestResults(
|
||||||
|
projectPath.resolve("TEST-all.xml"),
|
||||||
|
"nodeTest"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
projectPath.resolve("src/test/kotlin/Tests.kt").appendText(
|
projectPath.resolve("src/test/kotlin/Tests.kt").appendText(
|
||||||
"\n" + """
|
"\n" + """
|
||||||
|
|
|
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<results>
|
||||||
|
<testsuite name="Tests" tests="1" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
|
||||||
|
<properties />
|
||||||
|
<testcase name="testHello[node]" classname="Tests" time="..." />
|
||||||
|
<system-out />
|
||||||
|
<system-err />
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="Tests3" tests="1" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
|
||||||
|
<properties />
|
||||||
|
<testcase name="testHello[node]" classname="Tests3" time="...">
|
||||||
|
<failure message="..." type="IllegalArgumentException">...</failure>
|
||||||
|
</testcase>
|
||||||
|
<system-out />
|
||||||
|
<system-err />
|
||||||
|
</testsuite>
|
||||||
|
</results>
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
kotlin.tests.individualTaskReports=true
|
||||||
+1
-1
@@ -53,7 +53,7 @@ class TCServiceMessagesTestExecutor(
|
|||||||
if (spec.dryRunArgs != null) {
|
if (spec.dryRunArgs != null) {
|
||||||
val exec = execHandleFactory.newExec()
|
val exec = execHandleFactory.newExec()
|
||||||
spec.forkOptions.copyTo(exec)
|
spec.forkOptions.copyTo(exec)
|
||||||
exec.args = spec.args
|
exec.args = spec.dryRunArgs
|
||||||
// We do not need output by dry run of tests
|
// We do not need output by dry run of tests
|
||||||
exec.standardOutput = object : OutputStream() {
|
exec.standardOutput = object : OutputStream() {
|
||||||
override fun write(b: Int) {
|
override fun write(b: Int) {
|
||||||
|
|||||||
+11
-10
@@ -102,16 +102,17 @@ class KotlinMocha(@Transient override val compilation: KotlinJsCompilation, priv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val dryRunArgs = mutableListOf(
|
val dryRunArgs = if (platformType == KotlinPlatformType.wasm)
|
||||||
"--require",
|
null
|
||||||
npmProject.require("source-map-support/register.js")
|
else {
|
||||||
).apply {
|
mutableListOf(
|
||||||
if (debug) {
|
"--require",
|
||||||
add("--inspect-brk")
|
npmProject.require("source-map-support/register.js")
|
||||||
}
|
).apply {
|
||||||
add(createAdapterJs(file, "kotlin-test-nodejs-empty-runner", ADAPTER_EMPTY_NODEJS).canonicalPath)
|
add(mocha)
|
||||||
addAll(cliArgs.toList())
|
add(createAdapterJs(file, "kotlin-test-nodejs-empty-runner", ADAPTER_EMPTY_NODEJS).canonicalPath)
|
||||||
if (platformType == KotlinPlatformType.wasm) {
|
addAll(cliArgs.toList())
|
||||||
|
|
||||||
addAll(cliArg("-n", "experimental-wasm-typed-funcref,experimental-wasm-gc,experimental-wasm-eh"))
|
addAll(cliArg("-n", "experimental-wasm-typed-funcref,experimental-wasm-gc,experimental-wasm-eh"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user