[K/JS] Fix stdlib long path problem on Windows for ES modules tests
This commit is contained in:
@@ -310,16 +310,16 @@ val TestModule.kind: ModuleKind
|
||||
get() = directives.moduleKind
|
||||
|
||||
fun String.augmentWithModuleName(moduleName: String): String {
|
||||
return if (moduleName.isPath()) {
|
||||
replaceAfterLast(File.separator, moduleName.replace("./", ""))
|
||||
val normalizedName = moduleName.run { if (isWindows) minify() else this }
|
||||
|
||||
return if (normalizedName.isPath()) {
|
||||
replaceAfterLast(File.separator, normalizedName.replace("./", ""))
|
||||
} else {
|
||||
val suffix = when {
|
||||
endsWith(ESM_EXTENSION) -> ESM_EXTENSION
|
||||
endsWith(REGULAR_EXTENSION) -> REGULAR_EXTENSION
|
||||
else -> error("Unexpected file '$this' extension")
|
||||
}
|
||||
val normalizedName = moduleName.run { if (isWindows) minify() else this }
|
||||
|
||||
return removeSuffix("_v5$suffix") + "-${normalizedName}_v5$suffix"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.test.converters
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.isWindows
|
||||
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.safeName
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
@@ -26,7 +27,9 @@ class JsIrModuleToPath(val testServices: TestServices, shouldProvidePaths: Boole
|
||||
|
||||
override operator fun get(key: K): V? {
|
||||
return runIf(!isEmpty()) {
|
||||
"./${getJsArtifactSimpleName(testServices, key.safeName)}_v5.mjs"
|
||||
"./${getJsArtifactSimpleName(testServices, key.safeName)}_v5.mjs".run {
|
||||
if (isWindows) minify() else this
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user