diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-06-07 17:32:53 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-07 14:02:53 +0200 |
| commit | 89290741d18d9b247cefccdc95563ec688a28491 (patch) | |
| tree | 6740591c60f42696b0e6a9dea4a5d4ccf0f3534c /cli/tests | |
| parent | 3b3be024fa1895a9a1df0a2e67fe93aa888b198e (diff) | |
feat(compile): Initialize runtime_compiler ops for standalone binaries (#10052)
Diffstat (limited to 'cli/tests')
| -rw-r--r-- | cli/tests/integration_tests.rs | 32 | ||||
| -rw-r--r-- | cli/tests/standalone_compiler_ops.ts | 12 |
2 files changed, 44 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index d58080210..bc67d5479 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -5877,6 +5877,38 @@ console.log("finish"); } #[test] + fn standalone_compiler_ops() { + let dir = TempDir::new().expect("tempdir fail"); + let exe = if cfg!(windows) { + dir.path().join("standalone_compiler_ops.exe") + } else { + dir.path().join("standalone_compiler_ops") + }; + let output = util::deno_cmd() + .current_dir(util::root_path()) + .arg("compile") + .arg("--unstable") + .arg("--output") + .arg(&exe) + .arg("./cli/tests/standalone_compiler_ops.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, Compiler API!\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_compiler_ops.ts b/cli/tests/standalone_compiler_ops.ts new file mode 100644 index 000000000..b95e1222e --- /dev/null +++ b/cli/tests/standalone_compiler_ops.ts @@ -0,0 +1,12 @@ +const { files } = await Deno.emit("/mod.ts", { + bundle: "classic", + sources: { + "/mod.ts": `import { hello } from "/hello.ts"; console.log(hello);`, + "/hello.ts": `export const hello: string = "Hello, Compiler API!"`, + }, + compilerOptions: { + sourceMap: false, + }, +}); + +eval(files["deno:///bundle.js"]); |
