diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-06-05 19:54:17 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-05 16:24:17 +0200 |
| commit | e67010b5e2eaa5a5ddb756d7ddc2dd0194f09a0a (patch) | |
| tree | 1c5abb176c12922ed5ed769972e4edae5f604ceb /cli/tests | |
| parent | 4b3d55b449dd703aaa693410f0d37a2308bb0fd6 (diff) | |
feat(cli/compile): Support data uri dynamic imports in `deno compile` (#9936)
Diffstat (limited to 'cli/tests')
| -rw-r--r-- | cli/tests/integration_tests.rs | 32 | ||||
| -rw-r--r-- | cli/tests/standalone_import_datauri.ts | 4 |
2 files changed, 36 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 6c5626666..d58080210 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -5845,6 +5845,38 @@ console.log("finish"); } #[test] + fn standalone_load_datauri() { + let dir = TempDir::new().expect("tempdir fail"); + let exe = if cfg!(windows) { + dir.path().join("load_datauri.exe") + } else { + dir.path().join("load_datauri") + }; + let output = util::deno_cmd() + .current_dir(util::root_path()) + .arg("compile") + .arg("--unstable") + .arg("--output") + .arg(&exe) + .arg("./cli/tests/standalone_import_datauri.ts") + .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()); + assert_eq!(output.stdout, b"Hello Deno!\n"); + } + + #[test] fn compile_with_directory_exists_error() { let dir = TempDir::new().expect("tempdir fail"); let exe = if cfg!(windows) { diff --git a/cli/tests/standalone_import_datauri.ts b/cli/tests/standalone_import_datauri.ts new file mode 100644 index 000000000..68f348828 --- /dev/null +++ b/cli/tests/standalone_import_datauri.ts @@ -0,0 +1,4 @@ +const c = await import( + "data:text/javascript;base64,ZXhwb3J0IGRlZmF1bHQgJ0hlbGxvIERlbm8hJw==" +); +console.log(c.default); // Output: "Hello Deno!" |
