diff options
author | Cre3per <12541974+Cre3per@users.noreply.github.com> | 2023-03-22 15:15:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 10:15:53 -0400 |
commit | fd0658fb429e659b037cbf8b2a86459ce49cb3b3 (patch) | |
tree | 7ffa357ebfb18c5cd655677b5cc29c24089ddaa2 /cli/tests/integration/compile_tests.rs | |
parent | 50b793c9ed866ee29e8f04b4fa24b485b01a2b74 (diff) |
feat(cli): --ext parameter for run, compile, and bundle (#17172)
Adds `--ext` to `deno run`, closes #5088
Additionally
- Adds `--ext` to `deno compile` and `deno bundle`
Diffstat (limited to 'cli/tests/integration/compile_tests.rs')
-rw-r--r-- | cli/tests/integration/compile_tests.rs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/cli/tests/integration/compile_tests.rs b/cli/tests/integration/compile_tests.rs index 810cf5f80..957beed30 100644 --- a/cli/tests/integration/compile_tests.rs +++ b/cli/tests/integration/compile_tests.rs @@ -412,6 +412,82 @@ fn standalone_runtime_flags() { } #[test] +fn standalone_ext_flag_ts() { + let dir = TempDir::new(); + let exe = if cfg!(windows) { + dir.path().join("ext_flag_ts.exe") + } else { + dir.path().join("ext_flag_ts") + }; + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("compile") + .arg("--unstable") + .arg("--ext") + .arg("ts") + .arg("--output") + .arg(&exe) + .arg("./file_extensions/ts_without_extension") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + let output = Command::new(exe) + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + let stdout_str = String::from_utf8(output.stdout).unwrap(); + assert_eq!( + util::strip_ansi_codes(&stdout_str), + "executing typescript with no extension\n" + ); +} + +#[test] +fn standalone_ext_flag_js() { + let dir = TempDir::new(); + let exe = if cfg!(windows) { + dir.path().join("ext_flag_js.exe") + } else { + dir.path().join("ext_flag_js") + }; + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("compile") + .arg("--unstable") + .arg("--ext") + .arg("js") + .arg("--output") + .arg(&exe) + .arg("./file_extensions/js_without_extension") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + let output = Command::new(exe) + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + let stdout_str = String::from_utf8(output.stdout).unwrap(); + assert_eq!( + util::strip_ansi_codes(&stdout_str), + "executing javascript with no extension\n" + ); +} + +#[test] fn standalone_import_map() { let dir = TempDir::new(); let exe = if cfg!(windows) { |