/
_deno_unstable_test.ts
32 lines (31 loc) · 1.1 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
// 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 { code } = await Deno.spawn(Deno.execPath(), {
args: [
"run",
"--quiet",
"--unstable",
denoUnstableCheckedUrl.href,
],
stdout: "inherit",
stderr: "inherit",
});
assertEquals(code, 0);
} finally {
// TODO(nayeemrmn): Uncomment (https://github.com/denoland/deno_std/pull/1819#issuecomment-1011136991).
// await Deno.remove(denoUnstableCheckedUrl, {}).catch(() => {});
}
},
});