summaryrefslogtreecommitdiff
path: root/cli/tests/integration/run_tests.rs
diff options
context:
space:
mode:
authorAndreu Botella <abb@randomunok.com>2022-01-16 16:48:32 +0100
committerGitHub <noreply@github.com>2022-01-16 16:48:32 +0100
commit9def44979a0c3a03a7ada09f8359ea6b1d795d03 (patch)
tree57f7c71de64a8484871d163fc60e9c31bfbb8949 /cli/tests/integration/run_tests.rs
parentad224f53c798e8417a63d98daeaf3cadc199666c (diff)
fix(cli): Don't strip shebangs from modules (#13220)
Deno's module loader currently strips a shebang if a module file starts with one. However, this is no longer necessary, since there is a stage-3 TC39 that adds support for shebangs (or "hashbangs") to the language (https://github.com/tc39/proposal-hashbang), and V8, `tsc` and `swc` all support it. Furthermore, stripping shebangs causes a correctness bug with JSON modules, since a JSON file with a shebang should not parse as a JSON module, yet it does with this stripping. This change fixes this.
Diffstat (limited to 'cli/tests/integration/run_tests.rs')
-rw-r--r--cli/tests/integration/run_tests.rs22
1 files changed, 22 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()