diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/run_tests.rs | 22 | ||||
-rw-r--r-- | cli/tests/testdata/import_assertions/json_with_shebang.json | 4 | ||||
-rw-r--r-- | cli/tests/testdata/import_assertions/json_with_shebang.ts | 3 | ||||
-rw-r--r-- | cli/tests/testdata/import_assertions/json_with_shebang.ts.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/shebang.ts | 5 | ||||
-rw-r--r-- | cli/tests/testdata/shebang.ts.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/shebang2.ts | 3 |
7 files changed, 39 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index f4793a969..bc137a7fd 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -1600,6 +1600,28 @@ itest!(jsx_import_source_error { exit_code: 1, }); +itest!(shebang_tsc { + args: "run --quiet shebang.ts", + output: "shebang.ts.out", +}); + +itest!(shebang_swc { + args: "run --quiet --no-check shebang.ts", + output: "shebang.ts.out", +}); + +itest!(shebang_with_json_imports_tsc { + args: "run --quiet import_assertions/json_with_shebang.ts", + output: "import_assertions/json_with_shebang.ts.out", + exit_code: 1, +}); + +itest!(shebang_with_json_imports_swc { + args: "run --quiet --no-check import_assertions/json_with_shebang.ts", + output: "import_assertions/json_with_shebang.ts.out", + exit_code: 1, +}); + #[test] fn no_validate_asm() { let output = util::deno_cmd() diff --git a/cli/tests/testdata/import_assertions/json_with_shebang.json b/cli/tests/testdata/import_assertions/json_with_shebang.json new file mode 100644 index 000000000..b695e4457 --- /dev/null +++ b/cli/tests/testdata/import_assertions/json_with_shebang.json @@ -0,0 +1,4 @@ +#!/usr/env -S deno run +{ + "test": null +} diff --git a/cli/tests/testdata/import_assertions/json_with_shebang.ts b/cli/tests/testdata/import_assertions/json_with_shebang.ts new file mode 100644 index 000000000..523bf8772 --- /dev/null +++ b/cli/tests/testdata/import_assertions/json_with_shebang.ts @@ -0,0 +1,3 @@ +import json from "./json_with_shebang.json" assert { type: "json" }; + +console.log(json); diff --git a/cli/tests/testdata/import_assertions/json_with_shebang.ts.out b/cli/tests/testdata/import_assertions/json_with_shebang.ts.out new file mode 100644 index 000000000..ae5f3a65f --- /dev/null +++ b/cli/tests/testdata/import_assertions/json_with_shebang.ts.out @@ -0,0 +1 @@ +error: Uncaught SyntaxError: Unexpected token # in JSON at position 0 diff --git a/cli/tests/testdata/shebang.ts b/cli/tests/testdata/shebang.ts new file mode 100644 index 000000000..00feb2da0 --- /dev/null +++ b/cli/tests/testdata/shebang.ts @@ -0,0 +1,5 @@ +#!/usr/bin/env -S deno run + +import test from "./shebang2.ts"; + +console.log(test as number); diff --git a/cli/tests/testdata/shebang.ts.out b/cli/tests/testdata/shebang.ts.out new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/cli/tests/testdata/shebang.ts.out @@ -0,0 +1 @@ +42 diff --git a/cli/tests/testdata/shebang2.ts b/cli/tests/testdata/shebang2.ts new file mode 100644 index 000000000..da0d7bf0c --- /dev/null +++ b/cli/tests/testdata/shebang2.ts @@ -0,0 +1,3 @@ +#!/usr/bin/env -S deno run + +export default 42; |