[Wasm] Move compiler tests to `:wasm:wasm.tests` module

They don't belong in K/JS test module.
diff --git a/.gitignore b/.gitignore
index 7ac3a08..84041be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@
 .idea/artifacts/kotlin_stdlib_js_ir_*
 .idea/artifacts/kotlin_test_js_ir_*
 .idea/artifacts/kotlin_stdlib_wasm_*
+.idea/artifacts/kotlin_test_wasm_*
 .idea/artifacts/kotlinx_atomicfu_runtime_*
 .idea/artifacts/kotlinx_cli_jvm_*
 .idea/jarRepositories.xml
diff --git a/.idea/runConfigurations/Generate_Compiler_Tests.xml b/.idea/runConfigurations/Generate_Compiler_Tests.xml
index 5ff3a3e..23c55d3 100644
--- a/.idea/runConfigurations/Generate_Compiler_Tests.xml
+++ b/.idea/runConfigurations/Generate_Compiler_Tests.xml
@@ -16,6 +16,7 @@
           <option value=":js:js.tests:generateTests" />
           <option value=":native:native.tests:generateTests" />
           <option value=":core:descriptors.runtime:generateTests" />
+          <option value=":wasm:wasm.tests:generateTests" />
         </list>
       </option>
       <option name="vmOptions" value="" />
diff --git a/.space/CODEOWNERS b/.space/CODEOWNERS
index 0cc5cac..c9cf510 100644
--- a/.space/CODEOWNERS
+++ b/.space/CODEOWNERS
@@ -242,9 +242,6 @@
 /jps/ "Kotlin Build Tools"
 
 /js/ "Kotlin JS"
-/js/js.tests/test/org/jetbrains/kotlin/js/testOld/BasicWasmBoxTest.kt "Kotlin Wasm"
-/js/js.tests/test/org/jetbrains/kotlin/js/testOld/wasm/ "Kotlin Wasm"
-/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/ "Kotlin Wasm"
 
 /kotlin-js-store/ "Kotlin JS"
 
diff --git a/build.gradle.kts b/build.gradle.kts
index ba642d2..2ce8f32 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -669,7 +669,7 @@
     }
 
     register("wasmCompilerTest") {
-        dependsOn(":js:js.tests:wasmTest")
+        dependsOn(":wasm:wasm.tests:test")
         // Windows WABT release requires Visual C++ Redistributable
         if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
             dependsOn(":wasm:wasm.ir:test")
diff --git a/compiler/test-infrastructure/ReadMe.md b/compiler/test-infrastructure/ReadMe.md
index a16549e..12edc26 100644
--- a/compiler/test-infrastructure/ReadMe.md
+++ b/compiler/test-infrastructure/ReadMe.md
@@ -354,7 +354,7 @@
 
 To debug WASM tests, run:
 ```
-./gradlew :js:js.tests:wasmTest -Pfd.kotlin.wasm.debugMode=2
+./gradlew :wasm:wasm.tests:test -Pfd.kotlin.wasm.debugMode=2
 ```
 
 Values of the debug mode: `0` (or `false`), `1` (or `true`), `2`.
diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts
index 6ea94d4..26fe6c2 100644
--- a/js/js.tests/build.gradle.kts
+++ b/js/js.tests/build.gradle.kts
@@ -1,6 +1,4 @@
 import com.github.gradle.node.npm.task.NpmTask
-import de.undercouch.gradle.tasks.download.Download
-import org.gradle.internal.os.OperatingSystem
 import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
 import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
 import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
@@ -13,7 +11,6 @@
     kotlin("plugin.serialization")
     id("jps-compatible")
     id("com.github.node-gradle.node") version "3.2.1"
-    id("de.undercouch.download")
 }
 
 val nodeDir = buildDir.resolve("node")
@@ -48,7 +45,6 @@
     testCompileOnly(project(":compiler:util"))
     testCompileOnly(intellijCore())
     testApi(project(":compiler:backend.js"))
-    testApi(project(":compiler:backend.wasm"))
     testApi(project(":js:js.translator"))
     testApi(project(":js:js.serializer"))
     testApi(project(":js:js.dce"))
@@ -106,59 +102,8 @@
     }
 }
 
-enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN }
-enum class OsArch { X86_32, X86_64, ARM64, UNKNOWN }
-data class OsType(val name: OsName, val arch: OsArch)
 abstract class MochaTestTask : NpmTask(), VerificationTask
 
-val currentOsType = run {
-    val gradleOs = OperatingSystem.current()
-    val osName = when {
-        gradleOs.isMacOsX -> OsName.MAC
-        gradleOs.isWindows -> OsName.WINDOWS
-        gradleOs.isLinux -> OsName.LINUX
-        else -> OsName.UNKNOWN
-    }
-
-    val osArch = when (providers.systemProperty("sun.arch.data.model").forUseAtConfigurationTime().get()) {
-        "32" -> OsArch.X86_32
-        "64" -> when (providers.systemProperty("os.arch").forUseAtConfigurationTime().get().toLowerCase()) {
-            "aarch64" -> OsArch.ARM64
-            else -> OsArch.X86_64
-        }
-        else -> OsArch.UNKNOWN
-    }
-
-    OsType(osName, osArch)
-}
-
-val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2023/01/2023-01-23-09-44-44-mozilla-central"
-val jsShellSuffix = when (currentOsType) {
-    OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686"
-    OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64"
-    OsType(OsName.MAC, OsArch.X86_64),
-    OsType(OsName.MAC, OsArch.ARM64) -> "mac"
-    OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32"
-    OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64"
-    else -> error("unsupported os type $currentOsType")
-}
-val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip"
-
-val downloadedTools = File(buildDir, "tools")
-
-val downloadJsShell by task<Download> {
-    src(jsShellLocation)
-    dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip"))
-    overwrite(false)
-}
-
-val unzipJsShell by task<Copy> {
-    dependsOn(downloadJsShell)
-    from(zipTree(downloadJsShell.get().dest))
-    val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix")
-    into(unpackedDir)
-}
-
 val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
 val typescriptTestsDir = testDataDir.resolve("typescript-export")
 
@@ -262,12 +207,6 @@
     )
 }
 
-fun Test.setupSpiderMonkey() {
-    dependsOn(unzipJsShell)
-    val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
-    systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
-}
-
 val d8Plugin = D8RootPlugin.apply(rootProject)
 d8Plugin.version = v8Version
 
@@ -318,7 +257,6 @@
         inputs.dir(rootDir.resolve("libraries/kotlin.test/js-ir/build/classes/kotlin/js/main"))
     }
 
-    exclude("org/jetbrains/kotlin/js/testOld/wasm/semantics/*")
     exclude("org/jetbrains/kotlin/js/testOld/api/*")
 
     if (jsEnabled && !jsIrEnabled) {
@@ -485,21 +423,6 @@
     finalizedBy(mochaTest)
 }
 
-projectTest("wasmTest", true) {
-    setupV8()
-    setupSpiderMonkey()
-
-    include("org/jetbrains/kotlin/js/testOld/wasm/semantics/*")
-
-    dependsOn(":kotlin-stdlib-wasm:compileKotlinWasm")
-    systemProperty("kotlin.wasm.stdlib.path", "libraries/stdlib/wasm/build/classes/kotlin/wasm/main")
-
-    dependsOn(":kotlin-test:kotlin-test-wasm:compileKotlinWasm")
-    systemProperty("kotlin.wasm.kotlin.test.path", "libraries/kotlin.test/wasm/build/classes/kotlin/wasm/main")
-
-    setUpBoxTests()
-}
-
 projectTest("invalidationTest", jUnitMode = JUnitMode.JUnit4) {
     setupV8()
     workingDir = rootDir
diff --git a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt
index 7b5c985..f3765fa 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt
+++ b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt
@@ -7,7 +7,6 @@
 
 import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
 import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
-import org.jetbrains.kotlin.incremental.AbstractInvalidationTest
 import org.jetbrains.kotlin.incremental.AbstractJsIrES6InvalidationTest
 import org.jetbrains.kotlin.incremental.AbstractJsIrInvalidationTest
 import org.jetbrains.kotlin.js.test.*
@@ -15,7 +14,6 @@
 import org.jetbrains.kotlin.js.test.ir.*
 import org.jetbrains.kotlin.js.testOld.AbstractDceTest
 import org.jetbrains.kotlin.js.testOld.compatibility.binary.AbstractJsKlibBinaryCompatibilityTest
-import org.jetbrains.kotlin.js.testOld.wasm.semantics.*
 import org.jetbrains.kotlin.test.TargetBackend
 import org.jetbrains.kotlin.test.runners.ir.AbstractFir2IrJsTextTest
 
@@ -33,24 +31,6 @@
 
     generateTestGroupSuite(args) {
         testGroup("js/js.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") {
-            testClass<AbstractJsTranslatorWasmTest> {
-                model("box/main", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
-                model("box/native/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
-                model("box/esModules/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM,
-                    excludeDirs = listOf(
-                        // JsExport is not supported for classes
-                        "jsExport", "native", "export",
-                        // Multimodal infra is not supported. Also, we don't use ES modules for cross-module refs in Wasm
-                        "crossModuleRef", "crossModuleRefPerFile", "crossModuleRefPerModule"
-                    )
-                )
-                model("box/jsQualifier/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
-            }
-
-            testClass<AbstractJsTranslatorUnitWasmTest> {
-                model("box/kotlin.test/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
-            }
-
             testClass<AbstractDceTest> {
                 model("dce/", pattern = "(.+)\\.js", targetBackend = TargetBackend.JS)
             }
@@ -77,22 +57,6 @@
             }
         }
 
-        testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
-            testClass<AbstractIrCodegenBoxWasmTest> {
-                model(
-                    "codegen/box", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM, excludeDirs = jvmOnlyBoxTests
-                )
-            }
-
-            testClass<AbstractIrCodegenBoxInlineWasmTest> {
-                model("codegen/boxInline", targetBackend = TargetBackend.WASM)
-            }
-
-            testClass<AbstractIrCodegenWasmJsInteropWasmTest> {
-                model("codegen/boxWasmJsInterop", targetBackend = TargetBackend.WASM)
-            }
-        }
-
         testGroup("js/js.tests/tests-gen", "compiler/testData/binaryCompatibility", testRunnerMethodName = "runTest0") {
             testClass<AbstractJsKlibBinaryCompatibilityTest> {
                 model("klibEvolution", targetBackend = TargetBackend.JS_IR)
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/JsTestChecker.kt b/js/js.tests/test/org/jetbrains/kotlin/js/testOld/JsTestChecker.kt
index 94e0b67..4d66851 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/JsTestChecker.kt
+++ b/js/js.tests/test/org/jetbrains/kotlin/js/testOld/JsTestChecker.kt
@@ -12,6 +12,7 @@
 import org.jetbrains.kotlin.js.engine.loadFiles
 import org.junit.Assert
 
+internal const val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
 private const val DIST_DIR_JS_PATH = "dist/js/"
 private const val ESM_EXTENSION = ".mjs"
 
@@ -172,7 +173,7 @@
     }
 
     override val preloadedScripts = listOf(
-        BasicWasmBoxTest.TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
+        TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
         DIST_DIR_JS_PATH + "kotlin.js",
         DIST_DIR_JS_PATH + "kotlin-test.js"
     )
@@ -188,7 +189,7 @@
 
 object NashornIrJsTestChecker : AbstractNashornJsTestChecker() {
     override val preloadedScripts = listOf(
-        BasicWasmBoxTest.TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
+        TEST_DATA_DIR_PATH + "nashorn-polyfills.js",
         "libraries/stdlib/js-v1/src/js/polyfills.js"
     )
 }
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/ast/NameResolutionTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/testOld/ast/NameResolutionTest.kt
index 7110760..a667cbe 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/ast/NameResolutionTest.kt
+++ b/js/js.tests/test/org/jetbrains/kotlin/js/testOld/ast/NameResolutionTest.kt
@@ -23,7 +23,7 @@
 import org.jetbrains.kotlin.js.inline.clean.renameLabels
 import org.jetbrains.kotlin.js.inline.clean.resolveTemporaryNames
 import org.jetbrains.kotlin.js.parser.parse
-import org.jetbrains.kotlin.js.testOld.BasicWasmBoxTest
+import org.jetbrains.kotlin.js.testOld.TEST_DATA_DIR_PATH
 import org.junit.Assert.assertEquals
 import org.junit.Assert.fail
 import org.junit.Rule
@@ -50,7 +50,7 @@
 
     private fun doTest() {
         val methodName = testName.methodName
-        val baseName = "${BasicWasmBoxTest.TEST_DATA_DIR_PATH}/js-name-resolution/"
+        val baseName = "${TEST_DATA_DIR_PATH}/js-name-resolution/"
         val originalName = "$baseName/$methodName.original.js"
         val expectedName = "$baseName/$methodName.expected.js"
 
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/optimizer/BasicOptimizerTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/testOld/optimizer/BasicOptimizerTest.kt
index abef993..d2c8f7e 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/optimizer/BasicOptimizerTest.kt
+++ b/js/js.tests/test/org/jetbrains/kotlin/js/testOld/optimizer/BasicOptimizerTest.kt
@@ -13,7 +13,7 @@
 import org.jetbrains.kotlin.js.backend.ast.metadata.synthetic
 import org.jetbrains.kotlin.js.inline.clean.FunctionPostProcessor
 import org.jetbrains.kotlin.js.parser.parse
-import org.jetbrains.kotlin.js.testOld.BasicWasmBoxTest
+import org.jetbrains.kotlin.js.testOld.TEST_DATA_DIR_PATH
 import org.jetbrains.kotlin.js.testOld.createScriptEngine
 import org.jetbrains.kotlin.js.translate.utils.JsAstUtils
 import org.jetbrains.kotlin.js.util.TextOutputImpl
@@ -29,7 +29,7 @@
 
     protected fun box() {
         val methodName = testName.methodName
-        val baseName = "${BasicWasmBoxTest.TEST_DATA_DIR_PATH}/js-optimizer/$basePath"
+        val baseName = "${TEST_DATA_DIR_PATH}/js-optimizer/$basePath"
         val unoptimizedName = "$baseName/$methodName.original.js"
         val optimizedName = "$baseName/$methodName.optimized.js"
 
diff --git a/settings.gradle b/settings.gradle
index dd14e7a..1161012 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -302,6 +302,7 @@
         ":plugins:jvm-abi-gen-embeddable",
         ":test-instrumenter",
         ":wasm:wasm.ir",
+        ":wasm:wasm.tests",
         ":repo:codebase-tests"
 
 include ":kotlinx-atomicfu-compiler-plugin",
diff --git a/wasm/wasm.tests/build.gradle.kts b/wasm/wasm.tests/build.gradle.kts
new file mode 100644
index 0000000..6c092f7
--- /dev/null
+++ b/wasm/wasm.tests/build.gradle.kts
@@ -0,0 +1,138 @@
+import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
+import org.gradle.internal.os.OperatingSystem
+import de.undercouch.gradle.tasks.download.Download
+import java.util.*
+
+plugins {
+    kotlin("jvm")
+    id("jps-compatible")
+    id("de.undercouch.download")
+}
+
+dependencies {
+    testApi(commonDependency("junit:junit"))
+    testApi(projectTests(":compiler:tests-common"))
+    testApi(intellijCore())
+}
+
+val generationRoot = projectDir.resolve("tests-gen")
+
+optInToExperimentalCompilerApi()
+
+sourceSets {
+    "main" { }
+    "test" {
+        projectDefault()
+        this.java.srcDir(generationRoot.name)
+    }
+}
+
+val d8Plugin = D8RootPlugin.apply(rootProject)
+d8Plugin.version = v8Version
+
+fun Test.setupV8() {
+    dependsOn(d8Plugin.setupTaskProvider)
+    val v8ExecutablePath = project.provider {
+        d8Plugin.requireConfigured().executablePath.absolutePath
+    }
+    doFirst {
+        systemProperty("javascript.engine.path.V8", v8ExecutablePath.get())
+    }
+}
+
+fun Test.setupWasmStdlib() {
+    dependsOn(":kotlin-stdlib-wasm:compileKotlinWasm")
+    systemProperty("kotlin.wasm.stdlib.path", "libraries/stdlib/wasm/build/classes/kotlin/wasm/main")
+    dependsOn(":kotlin-test:kotlin-test-wasm:compileKotlinWasm")
+    systemProperty("kotlin.wasm.kotlin.test.path", "libraries/kotlin.test/wasm/build/classes/kotlin/wasm/main")
+}
+
+fun Test.setupGradlePropertiesForwarding() {
+    val rootLocalProperties = Properties().apply {
+        rootProject.file("local.properties").takeIf { it.isFile }?.inputStream()?.use {
+            load(it)
+        }
+    }
+
+    val allProperties = properties + rootLocalProperties
+
+    val prefixForPropertiesToForward = "fd."
+    for ((key, value) in allProperties) {
+        if (key is String && key.startsWith(prefixForPropertiesToForward)) {
+            systemProperty(key.substring(prefixForPropertiesToForward.length), value!!)
+        }
+    }
+}
+
+enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN }
+enum class OsArch { X86_32, X86_64, ARM64, UNKNOWN }
+data class OsType(val name: OsName, val arch: OsArch)
+
+val currentOsType = run {
+    val gradleOs = OperatingSystem.current()
+    val osName = when {
+        gradleOs.isMacOsX -> OsName.MAC
+        gradleOs.isWindows -> OsName.WINDOWS
+        gradleOs.isLinux -> OsName.LINUX
+        else -> OsName.UNKNOWN
+    }
+
+    val osArch = when (providers.systemProperty("sun.arch.data.model").forUseAtConfigurationTime().get()) {
+        "32" -> OsArch.X86_32
+        "64" -> when (providers.systemProperty("os.arch").forUseAtConfigurationTime().get().toLowerCase()) {
+            "aarch64" -> OsArch.ARM64
+            else -> OsArch.X86_64
+        }
+        else -> OsArch.UNKNOWN
+    }
+
+    OsType(osName, osArch)
+}
+
+val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2023/01/2023-01-23-09-44-44-mozilla-central"
+val jsShellSuffix = when (currentOsType) {
+    OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686"
+    OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64"
+    OsType(OsName.MAC, OsArch.X86_64),
+    OsType(OsName.MAC, OsArch.ARM64) -> "mac"
+    OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32"
+    OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64"
+    else -> error("unsupported os type $currentOsType")
+}
+val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip"
+
+val downloadedTools = File(buildDir, "tools")
+
+val downloadJsShell by task<Download> {
+    src(jsShellLocation)
+    dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip"))
+    overwrite(false)
+}
+
+val unzipJsShell by task<Copy> {
+    dependsOn(downloadJsShell)
+    from(zipTree(downloadJsShell.get().dest))
+    val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix")
+    into(unpackedDir)
+}
+
+fun Test.setupSpiderMonkey() {
+    dependsOn(unzipJsShell)
+    val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
+    systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
+}
+
+testsJar {}
+
+val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt") {
+    dependsOn(":compiler:generateTestData")
+}
+
+projectTest(parallel = true) {
+    workingDir = rootDir
+    setupV8()
+    setupSpiderMonkey()
+    setupWasmStdlib()
+    setupGradlePropertiesForwarding()
+    systemProperty("kotlin.wasm.test.root.out.dir", "$buildDir/")
+}
\ No newline at end of file
diff --git a/wasm/wasm.tests/test/org/jetbrains/kotlin/generators/tests/GenerateWasmTests.kt b/wasm/wasm.tests/test/org/jetbrains/kotlin/generators/tests/GenerateWasmTests.kt
new file mode 100644
index 0000000..32e0c1e
--- /dev/null
+++ b/wasm/wasm.tests/test/org/jetbrains/kotlin/generators/tests/GenerateWasmTests.kt
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+package org.jetbrains.kotlin.generators.tests
+
+import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
+import org.jetbrains.kotlin.test.TargetBackend
+import org.jetbrains.kotlin.wasm.test.*
+
+fun main(args: Array<String>) {
+    System.setProperty("java.awt.headless", "true")
+
+    val jvmOnlyBoxTests = listOf(
+        "compileKotlinAgainstKotlin",
+    )
+
+    generateTestGroupSuite(args) {
+        val jsTranslatorTestPattern = "^([^_](.+))\\.kt$"
+        testGroup("wasm/wasm.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") {
+            testClass<AbstractJsTranslatorWasmTest> {
+                model("box/main", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
+                model("box/native/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
+                model("box/esModules/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM,
+                    excludeDirs = listOf(
+                        // JsExport is not supported for classes
+                        "jsExport", "native", "export",
+                        // Multimodal infra is not supported. Also, we don't use ES modules for cross-module refs in Wasm
+                        "crossModuleRef", "crossModuleRefPerFile", "crossModuleRefPerModule"
+                    )
+                )
+                model("box/jsQualifier/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
+            }
+
+            testClass<AbstractJsTranslatorUnitWasmTest> {
+                model("box/kotlin.test/", pattern = jsTranslatorTestPattern, targetBackend = TargetBackend.WASM)
+            }
+        }
+
+        testGroup("wasm/wasm.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
+            testClass<AbstractIrCodegenBoxWasmTest> {
+                model("codegen/box", targetBackend = TargetBackend.WASM, pattern = jsTranslatorTestPattern, excludeDirs = jvmOnlyBoxTests)
+            }
+
+            testClass<AbstractIrCodegenBoxInlineWasmTest> {
+                model("codegen/boxInline", targetBackend = TargetBackend.WASM)
+            }
+
+            testClass<AbstractIrCodegenWasmJsInteropWasmTest> {
+                model("codegen/boxWasmJsInterop", targetBackend = TargetBackend.WASM)
+            }
+        }
+    }
+}
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/BasicWasmBoxTest.kt b/wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/BasicWasmBoxTest.kt
similarity index 98%
rename from js/js.tests/test/org/jetbrains/kotlin/js/testOld/BasicWasmBoxTest.kt
rename to wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/BasicWasmBoxTest.kt
index 398bfb7..db87b62 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/BasicWasmBoxTest.kt
+++ b/wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/BasicWasmBoxTest.kt
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld
+package org.jetbrains.kotlin.wasm.test
 
 import com.intellij.openapi.util.io.FileUtil
 import com.intellij.openapi.vfs.StandardFileSystems
@@ -24,7 +24,7 @@
 import org.jetbrains.kotlin.js.config.JSConfigurationKeys
 import org.jetbrains.kotlin.js.config.JsConfig
 import org.jetbrains.kotlin.js.facade.TranslationUnit
-import org.jetbrains.kotlin.js.testOld.engines.WasmVM
+import org.jetbrains.kotlin.wasm.test.tools.WasmVM
 import org.jetbrains.kotlin.name.FqName
 import org.jetbrains.kotlin.psi.KtFile
 import org.jetbrains.kotlin.psi.KtNamedFunction
@@ -42,7 +42,7 @@
     private val startUnitTests: Boolean = false
 ) : KotlinTestWithEnvironment() {
 
-    private val pathToRootOutputDir: String = System.getProperty("kotlin.js.test.root.out.dir") ?: error("'kotlin.js.test.root.out.dir' is not set")
+    private val pathToRootOutputDir: String = System.getProperty("kotlin.wasm.test.root.out.dir") ?: error("'kotlin.wasm.test.root.out.dir' is not set")
 
     private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix)
 
@@ -358,7 +358,6 @@
     }
 
     companion object {
-        const val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
         const val TEST_MODULE = "main"
         private const val TEST_FUNCTION = "box"
     }
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/wasm/semantics/abstractClassesForGeneratedWasmTests.kt b/wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/abstractClassesForGeneratedWasmTests.kt
similarity index 76%
rename from js/js.tests/test/org/jetbrains/kotlin/js/testOld/wasm/semantics/abstractClassesForGeneratedWasmTests.kt
rename to wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/abstractClassesForGeneratedWasmTests.kt
index 70ec2bb..c90ed23 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/wasm/semantics/abstractClassesForGeneratedWasmTests.kt
+++ b/wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/abstractClassesForGeneratedWasmTests.kt
@@ -1,11 +1,11 @@
 /*
- * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.wasm.semantics
+package org.jetbrains.kotlin.wasm.test
 
-import org.jetbrains.kotlin.js.testOld.BasicWasmBoxTest
+import org.jetbrains.kotlin.wasm.test.BasicWasmBoxTest
 
 abstract class AbstractIrCodegenBoxWasmTest : BasicWasmBoxTest(
     "compiler/testData/codegen/box/",
@@ -23,12 +23,12 @@
 )
 
 abstract class AbstractJsTranslatorWasmTest : BasicWasmBoxTest(
-    TEST_DATA_DIR_PATH + "box/",
+    "js/js.translator/testData/box/",
     "js.translator/wasmBox"
 )
 
 abstract class AbstractJsTranslatorUnitWasmTest : BasicWasmBoxTest(
-    TEST_DATA_DIR_PATH + "box/",
+    "js/js.translator/testData/box/",
     "js.translator/wasmBox",
     startUnitTests = true
 )
\ No newline at end of file
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/engines/WasmVM.kt b/wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/tools/WasmVM.kt
similarity index 97%
rename from js/js.tests/test/org/jetbrains/kotlin/js/testOld/engines/WasmVM.kt
rename to wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/tools/WasmVM.kt
index c776d14..7b09eee 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/testOld/engines/WasmVM.kt
+++ b/wasm/wasm.tests/test/org/jetbrains/kotlin/wasm/test/tools/WasmVM.kt
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.engines
+package org.jetbrains.kotlin.wasm.test.tools
 
 import java.io.BufferedReader
 import java.io.File
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java
similarity index 99%
rename from js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java
rename to wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java
index 5f6aba8..239911f 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.wasm.semantics;
+package org.jetbrains.kotlin.wasm.test;
 
 import com.intellij.testFramework.TestDataPath;
 import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -16,7 +16,7 @@
 import java.io.File;
 import java.util.regex.Pattern;
 
-/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
+/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
 @SuppressWarnings("all")
 @TestMetadata("compiler/testData/codegen/boxInline")
 @TestDataPath("$PROJECT_ROOT")
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java
similarity index 99%
rename from js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
rename to wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java
index bd7ec60..9d46dd8 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.wasm.semantics;
+package org.jetbrains.kotlin.wasm.test;
 
 import com.intellij.testFramework.TestDataPath;
 import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -17,7 +17,7 @@
 import java.io.File;
 import java.util.regex.Pattern;
 
-/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
+/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
 @SuppressWarnings("all")
 @TestMetadata("compiler/testData/codegen/box")
 @TestDataPath("$PROJECT_ROOT")
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenWasmJsInteropWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenWasmJsInteropWasmTestGenerated.java
similarity index 97%
rename from js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenWasmJsInteropWasmTestGenerated.java
rename to wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenWasmJsInteropWasmTestGenerated.java
index 06f6854..2b62684 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenWasmJsInteropWasmTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenWasmJsInteropWasmTestGenerated.java
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.wasm.semantics;
+package org.jetbrains.kotlin.wasm.test;
 
 import com.intellij.testFramework.TestDataPath;
 import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -16,7 +16,7 @@
 import java.io.File;
 import java.util.regex.Pattern;
 
-/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
+/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
 @SuppressWarnings("all")
 @TestMetadata("compiler/testData/codegen/boxWasmJsInterop")
 @TestDataPath("$PROJECT_ROOT")
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/JsTranslatorUnitWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/JsTranslatorUnitWasmTestGenerated.java
similarity index 95%
rename from js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/JsTranslatorUnitWasmTestGenerated.java
rename to wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/JsTranslatorUnitWasmTestGenerated.java
index dc069bd..19573ee 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/JsTranslatorUnitWasmTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/JsTranslatorUnitWasmTestGenerated.java
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.wasm.semantics;
+package org.jetbrains.kotlin.wasm.test;
 
 import com.intellij.testFramework.TestDataPath;
 import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -16,7 +16,7 @@
 import java.io.File;
 import java.util.regex.Pattern;
 
-/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
+/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
 @SuppressWarnings("all")
 @TestMetadata("js/js.translator/testData/box/kotlin.test")
 @TestDataPath("$PROJECT_ROOT")
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/JsTranslatorWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/JsTranslatorWasmTestGenerated.java
similarity index 98%
rename from js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/JsTranslatorWasmTestGenerated.java
rename to wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/JsTranslatorWasmTestGenerated.java
index c48dec1..eb09077 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/JsTranslatorWasmTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/JsTranslatorWasmTestGenerated.java
@@ -3,7 +3,7 @@
  * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
  */
 
-package org.jetbrains.kotlin.js.testOld.wasm.semantics;
+package org.jetbrains.kotlin.wasm.test;
 
 import com.intellij.testFramework.TestDataPath;
 import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -16,7 +16,7 @@
 import java.io.File;
 import java.util.regex.Pattern;
 
-/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
+/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateWasmTestsKt}. DO NOT MODIFY MANUALLY */
 @SuppressWarnings("all")
 @RunWith(JUnit3RunnerWithInners.class)
 public class JsTranslatorWasmTestGenerated extends AbstractJsTranslatorWasmTest {