summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/lock_write_fetch.ts
blob: b403f5536c800ac9a948809045a7be0d7d2d5f59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
try {
  Deno.removeSync("./lock_write_fetch.json");
} catch {
  // pass
}

const fetchProc = await Deno.spawn(Deno.execPath(), {
  stdout: "null",
  stderr: "null",
  args: [
    "cache",
    "--reload",
    "--lock=lock_write_fetch.json",
    "--lock-write",
    "--cert=tls/RootCA.pem",
    "https_import.ts",
  ],
});

console.log(`fetch code: ${fetchProc.code}`);

const fetchCheckProc = await Deno.spawn(Deno.execPath(), {
  stdout: "null",
  stderr: "null",
  args: [
    "cache",
    "--lock=lock_write_fetch.json",
    "--cert=tls/RootCA.pem",
    "https_import.ts",
  ],
});

console.log(`fetch check code: ${fetchCheckProc.code}`);

Deno.removeSync("./lock_write_fetch.json");

const runProc = await Deno.spawn(Deno.execPath(), {
  stdout: "null",
  stderr: "null",
  args: [
    "run",
    "--lock=lock_write_fetch.json",
    "--lock-write",
    "--allow-read",
    "file_exists.ts",
    "lock_write_fetch.json",
  ],
});

console.log(`run code: ${runProc.code}`);

Deno.removeSync("./lock_write_fetch.json");