/
_deno_unstable_test.ts
33 lines (32 loc) · 1.12 KB
/
_deno_unstable_test.ts
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
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "./testing/asserts.ts";
Deno.test({
name: "_deno_unstable.ts complies with --unstable if type checked",
async fn() {
const denoUnstableUrl = new URL("_deno_unstable.ts", import.meta.url);
const denoUnstableCheckedUrl = new URL(
"_deno_unstable_checked.ts",
import.meta.url,
);
const code = await Deno.readTextFile(denoUnstableUrl);
const checkedCode = `// AUTOGENERATED\n${code.replace("@ts-nocheck ", "")}`;
try {
await Deno.writeTextFile(denoUnstableCheckedUrl, checkedCode);
const process = Deno.run({
cmd: [
Deno.execPath(),
"run",
"--quiet",
"--unstable",
denoUnstableCheckedUrl.href,
],
});
const status = await process.status();
process.close();
assertEquals(status.code, 0);
} finally {
// TODO(nayeemrmn): Uncomment (https://github.com/denoland/deno_std/pull/1819#issuecomment-1011136991).
// await Deno.remove(denoUnstableCheckedUrl, {}).catch(() => {});
}
},
});