summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs7
-rw-r--r--cli/tests/lock_write_fetch.ts44
-rw-r--r--cli/tests/lock_write_fetch.ts.out3
3 files changed, 54 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index ce3828b8b..52fc254c5 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -391,6 +391,13 @@ itest!(_054_info_local_imports {
exit_code: 0,
});
+itest!(lock_write_fetch {
+ args:
+ "run --allow-read --allow-write --allow-env --allow-run lock_write_fetch.ts",
+ output: "lock_write_fetch.ts.out",
+ exit_code: 0,
+});
+
itest!(lock_check_ok {
args: "run --lock=lock_check_ok.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts",
output: "003_relative_import.ts.out",
diff --git a/cli/tests/lock_write_fetch.ts b/cli/tests/lock_write_fetch.ts
new file mode 100644
index 000000000..7d597724d
--- /dev/null
+++ b/cli/tests/lock_write_fetch.ts
@@ -0,0 +1,44 @@
+try {
+ Deno.removeSync("./lock_write_fetch.json");
+} catch {}
+
+const fetchProc = Deno.run({
+ stdout: "null",
+ stderr: "null",
+ args: [
+ Deno.execPath(),
+ "fetch",
+ "--reload",
+ "--lock=lock_write_fetch.json",
+ "--lock-write",
+ "https_import.ts"
+ ]
+});
+
+const fetchCode = (await fetchProc.status()).code;
+console.log(`fetch code: ${fetchCode}`);
+
+const fetchCheckProc = Deno.run({
+ stdout: "null",
+ stderr: "null",
+ args: [
+ Deno.execPath(),
+ "fetch",
+ "--lock=lock_write_fetch.json",
+ "https_import.ts"
+ ]
+});
+
+const fetchCheckProcCode = (await fetchCheckProc.status()).code;
+console.log(`fetch check code: ${fetchCheckProcCode}`);
+
+const runProc = Deno.run({
+ stdout: "null",
+ stderr: "null",
+ args: [Deno.execPath(), "--lock=lock_write_fetch.json", "https_import.ts"]
+});
+
+const runCode = (await runProc.status()).code;
+console.log(`run code: ${runCode}`);
+
+Deno.removeSync("./lock_write_fetch.json");
diff --git a/cli/tests/lock_write_fetch.ts.out b/cli/tests/lock_write_fetch.ts.out
new file mode 100644
index 000000000..bfdb952f9
--- /dev/null
+++ b/cli/tests/lock_write_fetch.ts.out
@@ -0,0 +1,3 @@
+fetch code: 0
+fetch check code: 0
+run code: 0