[JS IR] .d.ts generation for module systems

Support .d.ts generation for UMD, AMD, CommonJS module kinds in
addition to existing "plain" module kind.
This commit is contained in:
Svyatoslav Kuzmich
2020-07-14 14:16:41 +03:00
parent ee23e39b3c
commit 609f0ca9bc
11 changed files with 189 additions and 9 deletions
@@ -83,6 +83,34 @@ public class IrJsTypeScriptExportES6TestGenerated extends AbstractIrJsTypeScript
}
}
@TestMetadata("js/js.translator/testData/typescript-export/moduleSystems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ModuleSystems extends AbstractIrJsTypeScriptExportES6Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
public void testAllFilesPresentInModuleSystems() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/moduleSystems"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("commonjs.kt")
public void testCommonjs() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/commonjs.kt");
}
@TestMetadata("plain.kt")
public void testPlain() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/plain.kt");
}
@TestMetadata("umd.kt")
public void testUmd() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/umd.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/namespaces")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -83,6 +83,34 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
}
}
@TestMetadata("js/js.translator/testData/typescript-export/moduleSystems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ModuleSystems extends AbstractIrJsTypeScriptExportTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInModuleSystems() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/moduleSystems"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("commonjs.kt")
public void testCommonjs() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/commonjs.kt");
}
@TestMetadata("plain.kt")
public void testPlain() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/plain.kt");
}
@TestMetadata("umd.kt")
public void testUmd() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/umd.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/namespaces")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -78,6 +78,34 @@ public class LegacyJsTypeScriptExportTestGenerated extends AbstractLegacyJsTypeS
}
}
@TestMetadata("js/js.translator/testData/typescript-export/moduleSystems")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ModuleSystems extends AbstractLegacyJsTypeScriptExportTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInModuleSystems() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/moduleSystems"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("commonjs.kt")
public void testCommonjs() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/commonjs.kt");
}
@TestMetadata("plain.kt")
public void testPlain() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/plain.kt");
}
@TestMetadata("umd.kt")
public void testUmd() throws Exception {
runTest("js/js.translator/testData/typescript-export/moduleSystems/umd.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/namespaces")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)