From 7a8e2298f6a0ac96c7d513b1250715f06c1e0259 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Thu, 17 Oct 2024 16:38:22 +0200 Subject: [PATCH] Introduce workaround for module names that end with "-test" prefix - they can cause issues with js tests https://youtrack.jetbrains.com/issue/KT-72362/js-running-tests-leads-to-compilation-error-if-one-modules-name-is-a-special-prefix-to-another-one --- .../build/AndroidXComposeMultiplatformExtensionImpl.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeMultiplatformExtensionImpl.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeMultiplatformExtensionImpl.kt index 06e1b09afbfa0..1cdad12da48b3 100644 --- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeMultiplatformExtensionImpl.kt +++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeMultiplatformExtensionImpl.kt @@ -75,7 +75,14 @@ open class AndroidXComposeMultiplatformExtensionImpl @Inject constructor( } override fun js(): Unit = multiplatformExtension.run { - js(KotlinJsCompilerType.IR) { + js(KotlinJsCompilerType.IR) { + // We have to rename such modules (as npm packages exclusively - this does not affect anything package conventions in the prod artifact + // This is a workaround for https://youtrack.jetbrains.com/issue/KT-72362/js-running-tests-leads-to-compilation-error-if-one-modules-name-is-a-special-prefix-to-another-one + // TODO: get rid of this workaround as soon as we'll have a fix in tooling + if (project.name.endsWith("-test")) { + moduleName = project.name + "-npm" + } + browser { testTask { it.useKarma {