diff options
| author | Kenta Moriuchi <moriken@kimamass.com> | 2024-04-30 05:43:05 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 22:43:05 +0200 |
| commit | 783533d2e354ad73356d7517b26293e48c10fc17 (patch) | |
| tree | 68bd0fa01c59ab9c4ad6d2010fabb9babf6d8d85 /tests/specs | |
| parent | 4384a126bb759580777e7a2678fe49bb015f2f69 (diff) | |
FUTURE: remove import assertions support for JavaScript (#23541)
Ref #17944, https://github.com/swc-project/swc/issues/8893
TypeScript removes the `assert` keywords in the transpile, so this PR
only works for JavaScript files
Diffstat (limited to 'tests/specs')
| -rw-r--r-- | tests/specs/future/import_assertions/__test__.jsonc | 16 | ||||
| -rw-r--r-- | tests/specs/future/import_assertions/error.out | 4 | ||||
| -rw-r--r-- | tests/specs/future/import_assertions/main.js | 2 | ||||
| -rw-r--r-- | tests/specs/future/import_assertions/main.json | 3 | ||||
| -rw-r--r-- | tests/specs/future/import_assertions/success.out | 1 |
5 files changed, 26 insertions, 0 deletions
diff --git a/tests/specs/future/import_assertions/__test__.jsonc b/tests/specs/future/import_assertions/__test__.jsonc new file mode 100644 index 000000000..a1e759c75 --- /dev/null +++ b/tests/specs/future/import_assertions/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "steps": [ + { + "args": "run main.js", + "output": "error.out", + "exitCode": 1, + "envs": { + "DENO_FUTURE": "1" + } + }, + { + "args": "run main.js", + "output": "success.out" + } + ] +} diff --git a/tests/specs/future/import_assertions/error.out b/tests/specs/future/import_assertions/error.out new file mode 100644 index 000000000..cef663f35 --- /dev/null +++ b/tests/specs/future/import_assertions/error.out @@ -0,0 +1,4 @@ +error: Uncaught SyntaxError: Unexpected identifier 'assert' +import foo from "./main.json" assert { type: "json" }; + ^ + at <anonymous> (file:///[WILDCARD]/main.js:[WILDCARD]) diff --git a/tests/specs/future/import_assertions/main.js b/tests/specs/future/import_assertions/main.js new file mode 100644 index 000000000..9b4c4d036 --- /dev/null +++ b/tests/specs/future/import_assertions/main.js @@ -0,0 +1,2 @@ +import foo from "./main.json" assert { type: "json" }; +console.log(foo); diff --git a/tests/specs/future/import_assertions/main.json b/tests/specs/future/import_assertions/main.json new file mode 100644 index 000000000..abdd5202b --- /dev/null +++ b/tests/specs/future/import_assertions/main.json @@ -0,0 +1,3 @@ +{ + "foo": "foo" +} diff --git a/tests/specs/future/import_assertions/success.out b/tests/specs/future/import_assertions/success.out new file mode 100644 index 000000000..70ec274d9 --- /dev/null +++ b/tests/specs/future/import_assertions/success.out @@ -0,0 +1 @@ +{ foo: "foo" } |
