From 15392c32f81c0abe16b532b69d2827f7823a3eaf Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Fri, 1 Oct 2021 07:39:56 +0900 Subject: [PATCH] Add plugin-transform-typescript tests --- .../fixtures/exports/type-only-export-specifier-1/input.ts | 2 ++ .../fixtures/exports/type-only-export-specifier-1/output.mjs | 3 +++ .../fixtures/exports/type-only-export-specifier-2/input.ts | 1 + .../fixtures/exports/type-only-export-specifier-2/output.mjs | 1 + .../fixtures/exports/type-only-export-specifier-3/input.ts | 1 + .../fixtures/exports/type-only-export-specifier-3/output.mjs | 1 + .../test/fixtures/imports/only-remove-type-imports/input.ts | 2 ++ .../test/fixtures/imports/only-remove-type-imports/output.mjs | 1 + .../fixtures/imports/type-only-import-specifier-1/input.ts | 2 ++ .../fixtures/imports/type-only-import-specifier-1/output.mjs | 2 ++ .../fixtures/imports/type-only-import-specifier-2/input.ts | 1 + .../fixtures/imports/type-only-import-specifier-2/output.mjs | 1 + 12 files changed, 18 insertions(+) create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/output.mjs create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/output.mjs create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/output.mjs create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/output.mjs create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/output.mjs diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/input.ts new file mode 100644 index 000000000000..d268127794d9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/input.ts @@ -0,0 +1,2 @@ +class Foo {} +export { type Foo }; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/output.mjs new file mode 100644 index 000000000000..736b92725dc2 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-1/output.mjs @@ -0,0 +1,3 @@ +class Foo {} + +export {}; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/input.ts new file mode 100644 index 000000000000..b7724a25247d --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/input.ts @@ -0,0 +1 @@ +export { type A1, type A2 } from "a" diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/output.mjs new file mode 100644 index 000000000000..cb0ff5c3b541 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-2/output.mjs @@ -0,0 +1 @@ +export {}; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/input.ts new file mode 100644 index 000000000000..a6431530d3ac --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/input.ts @@ -0,0 +1 @@ +export { type A1, type A2, A3 } from "a" diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/output.mjs new file mode 100644 index 000000000000..da23041dfb5d --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/type-only-export-specifier-3/output.mjs @@ -0,0 +1 @@ +export { A3 } from "a"; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts index 744ae808eaa9..6b2b75d9f454 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/input.ts @@ -10,4 +10,6 @@ import "g"; import type H from "h"; import type { I, I2 } from "i"; import type * as J from "j"; +import { type K1, type K2 } from "k"; +import { type L1, L2, type L3 } from "l"; ; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs index d86475cacac8..78a426b356b2 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/only-remove-type-imports/output.mjs @@ -5,4 +5,5 @@ import d, { d2 } from "d"; import e, { e3 as e4 } from "e"; import "f"; import "g"; +import { L2 } from "l"; ; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/input.ts new file mode 100644 index 000000000000..e4fde7f90cb3 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/input.ts @@ -0,0 +1,2 @@ +import { Foo1, type Foo2 } from "Foo"; +Foo1; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/output.mjs new file mode 100644 index 000000000000..b960b41f8c81 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-1/output.mjs @@ -0,0 +1,2 @@ +import { Foo1 } from "Foo"; +Foo1; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/input.ts new file mode 100644 index 000000000000..d40d26bca8f4 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/input.ts @@ -0,0 +1 @@ +import { type Foo1, type Foo2 } from "Foo"; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/output.mjs new file mode 100644 index 000000000000..cb0ff5c3b541 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/type-only-import-specifier-2/output.mjs @@ -0,0 +1 @@ +export {};