summaryrefslogtreecommitdiff
path: root/cli/tests/lock_write_fetch.ts
blob: b6ecf4747222e7e04771c97a3184764e0748bd70 (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
53
54
55
56
57
58
try {
  Deno.removeSync("./lock_write_fetch.json");
} catch {
  // pass
}

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

const fetchCode = (await fetchProc.status()).code;
console.log(`fetch code: ${fetchCode}`);

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

const fetchCheckProcCode = (await fetchCheckProc.status()).code;
console.log(`fetch check code: ${fetchCheckProcCode}`);

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

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

const runCode = (await runProc.status()).code;
console.log(`run code: ${runCode}`);

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