[Gradle, Wasm] Fix proxy for karma wasm tests on windows
^KT-62128 fixed
This commit is contained in:
committed by
Space Team
parent
4c9ad970ff
commit
376d27dc6a
+11
-2
@@ -354,7 +354,7 @@ class KotlinKarma(
|
|||||||
createLoadWasm(npmProject.dir, file).normalize().absolutePath
|
createLoadWasm(npmProject.dir, file).normalize().absolutePath
|
||||||
)
|
)
|
||||||
|
|
||||||
config.proxies["/${wasmFile.name}"] = wasmFileString
|
config.proxies["/${wasmFile.name}"] = basify(npmProjectDir, wasmFile)
|
||||||
|
|
||||||
config.customContextFile = npmProject.require("kotlin-test-js-runner/static/context.html")
|
config.customContextFile = npmProject.require("kotlin-test-js-runner/static/context.html")
|
||||||
config.customDebugFile = npmProject.require("kotlin-test-js-runner/static/debug.html")
|
config.customDebugFile = npmProject.require("kotlin-test-js-runner/static/debug.html")
|
||||||
@@ -396,7 +396,7 @@ class KotlinKarma(
|
|||||||
escapeTCMessagesInLog = isTeamCity.isPresent
|
escapeTCMessagesInLog = isTeamCity.isPresent
|
||||||
)
|
)
|
||||||
|
|
||||||
config.basePath = npmProject.nodeModulesDir.absolutePath
|
config.basePath = npmProjectDir.absolutePath
|
||||||
|
|
||||||
configurators.forEach {
|
configurators.forEach {
|
||||||
it(task)
|
it(task)
|
||||||
@@ -606,6 +606,15 @@ class KotlinKarma(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In Karma config it means relative path based on basePath which is configured inside Karma config
|
||||||
|
// It helps to get rid of windows backslashes in proxies config
|
||||||
|
// `base` is using because of how Karma works with proxies
|
||||||
|
// http://karma-runner.github.io/6.4/config/configuration-file.html#proxies
|
||||||
|
// http://karma-runner.github.io/6.4/config/files.html#loading-assets
|
||||||
|
internal fun basify(npmProjectDir: File, file: File): String {
|
||||||
|
return "/base/${file.relativeTo(npmProjectDir).invariantSeparatorsPath}"
|
||||||
|
}
|
||||||
|
|
||||||
internal fun createLoadWasm(npmProjectDir: File, file: File): File {
|
internal fun createLoadWasm(npmProjectDir: File, file: File): File {
|
||||||
val static = npmProjectDir.resolve("static").also {
|
val static = npmProjectDir.resolve("static").also {
|
||||||
it.mkdirs()
|
it.mkdirs()
|
||||||
|
|||||||
+13
@@ -35,4 +35,17 @@ class KotlinKarmaTest {
|
|||||||
loadWasm.readText().trimIndent()
|
loadWasm.readText().trimIndent()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun checkBasify() {
|
||||||
|
val npmProjectDir = createTempDirectory("tmp")
|
||||||
|
val executableFile = npmProjectDir.resolve("kotlin/main.wasm")
|
||||||
|
|
||||||
|
val based = basify(npmProjectDir.toFile(), executableFile.toFile())
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"/base/kotlin/main.wasm",
|
||||||
|
based
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user