-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathrun-tests.ts
More file actions
36 lines (28 loc) · 1.01 KB
/
run-tests.ts
File metadata and controls
36 lines (28 loc) · 1.01 KB
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
import path from "node:path";
import { test, type TestContext } from "node:test";
import { listDirectoryEntries, runFileInSubprocess } from "./tests.ts";
const ROOT_PATH = path.resolve(import.meta.dirname, "..", "..");
const TESTS_ROOT_PATH = path.join(ROOT_PATH, "tests");
async function populateSuite(
testContext: TestContext,
dir: string
): Promise<void> {
const { directories, files } = listDirectoryEntries(dir);
for (const file of files) {
await testContext.test(file, () => runFileInSubprocess(dir, file));
}
for (const directory of directories) {
await testContext.test(directory, async (subTest) => {
await populateSuite(subTest, path.join(dir, directory));
});
}
}
test("harness", async (t) => {
await populateSuite(t, path.join(TESTS_ROOT_PATH, "harness"));
});
test("js-native-api", async (t) => {
await populateSuite(t, path.join(TESTS_ROOT_PATH, "js-native-api"));
});
test("node-api", async (t) => {
await populateSuite(t, path.join(TESTS_ROOT_PATH, "node-api"));
});