[K/Wasm] Generate .d.ts tests for K/Wasm in the same way as we do for K/JS ^KT-65778 Fixed
This commit is contained in:
@@ -117,6 +117,7 @@ abstract class MochaTestTask : NpmTask(), VerificationTask
|
||||
|
||||
val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
|
||||
val typescriptTestsDir = testDataDir.resolve("typescript-export")
|
||||
val jsTestsDir = typescriptTestsDir.resolve("js")
|
||||
|
||||
val installTsDependencies by task<NpmTask> {
|
||||
val packageLockFile = testDataDir.resolve("package-lock.json")
|
||||
@@ -129,30 +130,12 @@ val installTsDependencies by task<NpmTask> {
|
||||
args.set(listOf("install"))
|
||||
}
|
||||
|
||||
fun parallel(tasksToRun: List<TaskProvider<*>>, beforeAll: TaskProvider<*>? = null, afterAll: TaskProvider<*>? = null): RegisteringDomainObjectDelegateProviderWithAction<out TaskContainer, Task> {
|
||||
return tasks.registering {
|
||||
tasksToRun.forEach { dependsOn(it) }
|
||||
|
||||
if (afterAll != null) {
|
||||
finalizedBy(afterAll)
|
||||
}
|
||||
}.apply {
|
||||
if (beforeAll != null) {
|
||||
tasksToRun.forEach {
|
||||
it.configure {
|
||||
dependsOn(beforeAll)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val exportFileDirPostfix = "-in-exported-file"
|
||||
|
||||
fun generateJsExportOnFileTestFor(dir: String): TaskProvider<Copy> = tasks.register<Copy>("generate-js-export-on-file-for-$dir") {
|
||||
val dirPostfix = exportFileDirPostfix
|
||||
val inputDir = fileTree(typescriptTestsDir.resolve(dir))
|
||||
val outputDir = typescriptTestsDir.resolve("$dir$dirPostfix")
|
||||
val inputDir = fileTree(jsTestsDir.resolve(dir))
|
||||
val outputDir = jsTestsDir.resolve("$dir$dirPostfix")
|
||||
|
||||
inputs.files(inputDir.matching {
|
||||
include("**/*.kt")
|
||||
@@ -191,7 +174,7 @@ fun generateJsExportOnFileTestFor(dir: String): TaskProvider<Copy> = tasks.regis
|
||||
}
|
||||
|
||||
fun generateTypeScriptTestFor(dir: String): TaskProvider<NpmTask> = tasks.register<NpmTask>("generate-ts-for-$dir") {
|
||||
val baseDir = typescriptTestsDir.resolve(dir)
|
||||
val baseDir = jsTestsDir.resolve(dir)
|
||||
val mainTsFile = fileTree(baseDir).files.find { it.name.endsWith("__main.ts") } ?: return@register
|
||||
val mainJsFile = baseDir.resolve("${mainTsFile.nameWithoutExtension}.js")
|
||||
|
||||
@@ -201,12 +184,12 @@ fun generateTypeScriptTestFor(dir: String): TaskProvider<NpmTask> = tasks.regist
|
||||
outputs.file(mainJsFile)
|
||||
outputs.upToDateWhen { mainJsFile.exists() }
|
||||
|
||||
args.set(listOf("run", "generateTypeScriptTests", "--", "./typescript-export/$dir/tsconfig.json"))
|
||||
args.set(listOf("run", "generateTypeScriptTests", "--", "./typescript-export/js/$dir/tsconfig.json"))
|
||||
}
|
||||
|
||||
val generateTypeScriptTests by parallel(
|
||||
beforeAll = installTsDependencies,
|
||||
tasksToRun = typescriptTestsDir.listFiles { it: File ->
|
||||
tasksToRun = jsTestsDir.listFiles { it: File ->
|
||||
it.isDirectory &&
|
||||
!it.path.endsWith("module-systems") &&
|
||||
!it.path.endsWith("module-systems-in-exported-file")
|
||||
@@ -215,7 +198,7 @@ val generateTypeScriptTests by parallel(
|
||||
)
|
||||
|
||||
val generateTypeScriptJsExportOnFileTests by parallel(
|
||||
typescriptTestsDir
|
||||
jsTestsDir
|
||||
.listFiles { it: File ->
|
||||
it.isDirectory &&
|
||||
!it.path.endsWith("selective-export") &&
|
||||
|
||||
@@ -140,11 +140,11 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractIrJsTypeScriptExportTest> {
|
||||
model("typescript-export/", pattern = "^([^_](.+))\\.kt$")
|
||||
model("typescript-export/js/", pattern = "^([^_](.+))\\.kt$")
|
||||
}
|
||||
|
||||
testClass<AbstractIrJsES6TypeScriptExportTest> {
|
||||
model("typescript-export/", pattern = "^([^_](.+))\\.kt$")
|
||||
model("typescript-export/js/", pattern = "^([^_](.+))\\.kt$")
|
||||
}
|
||||
|
||||
testClass<AbstractJsIrLineNumberTest> {
|
||||
@@ -164,11 +164,11 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractFirJsTypeScriptExportTest> {
|
||||
model("typescript-export/", pattern = "^([^_](.+))\\.kt$")
|
||||
model("typescript-export/js/", pattern = "^([^_](.+))\\.kt$")
|
||||
}
|
||||
|
||||
testClass<AbstractFirJsES6TypeScriptExportTest> {
|
||||
model("typescript-export/", pattern = "^([^_](.+))\\.kt$")
|
||||
model("typescript-export/js/", pattern = "^([^_](.+))\\.kt$")
|
||||
}
|
||||
|
||||
testClass<AbstractFirJsLineNumberTest> {
|
||||
|
||||
@@ -101,7 +101,7 @@ open class AbstractIrJsCodegenInlineTest : AbstractJsIrTest(
|
||||
)
|
||||
|
||||
open class AbstractIrJsTypeScriptExportTest : AbstractJsIrTest(
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/typescript-export/",
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/typescript-export/js/",
|
||||
testGroupOutputDirPrefix = "typescript-export/ir/"
|
||||
) {
|
||||
override fun configure(builder: TestConfigurationBuilder) {
|
||||
@@ -111,7 +111,7 @@ open class AbstractIrJsTypeScriptExportTest : AbstractJsIrTest(
|
||||
}
|
||||
|
||||
open class AbstractIrJsES6TypeScriptExportTest : AbstractJsIrES6Test(
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/typescript-export/",
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/typescript-export/js/",
|
||||
testGroupOutputDirPrefix = "typescript-export/ir-es6/"
|
||||
) {
|
||||
override fun configure(builder: TestConfigurationBuilder) {
|
||||
|
||||
Generated
-11
@@ -9,7 +9,6 @@ import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -108,14 +107,4 @@ public class FirJsCodegenWasmJsInteropTestGenerated extends AbstractFirJsCodegen
|
||||
public void testVararg() {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/vararg.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxWasmJsInterop/typeScriptDeclarations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TypeScriptDeclarations {
|
||||
@Test
|
||||
public void testAllFilesPresentInTypeScriptDeclarations() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxWasmJsInterop/typeScriptDeclarations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-11
@@ -9,7 +9,6 @@ import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -108,14 +107,4 @@ public class FirJsES6CodegenWasmJsInteropTestGenerated extends AbstractFirJsES6C
|
||||
public void testVararg() {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/vararg.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxWasmJsInterop/typeScriptDeclarations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TypeScriptDeclarations {
|
||||
@Test
|
||||
public void testAllFilesPresentInTypeScriptDeclarations() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxWasmJsInterop/typeScriptDeclarations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+162
-162
File diff suppressed because it is too large
Load Diff
Generated
+162
-162
File diff suppressed because it is too large
Load Diff
Generated
-11
@@ -9,7 +9,6 @@ import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -108,14 +107,4 @@ public class IrCodegenWasmJsInteropJsTestGenerated extends AbstractIrCodegenWasm
|
||||
public void testVararg() {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/vararg.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxWasmJsInterop/typeScriptDeclarations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TypeScriptDeclarations {
|
||||
@Test
|
||||
public void testAllFilesPresentInTypeScriptDeclarations() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxWasmJsInterop/typeScriptDeclarations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+162
-162
File diff suppressed because it is too large
Load Diff
Generated
+162
-162
File diff suppressed because it is too large
Load Diff
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"strict": true,
|
||||
"newLine": "lf",
|
||||
"lib": ["es2015", "dom"]
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../../common.tsconfig.json"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user