-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.ts
94 lines (59 loc) 路 1.74 KB
/
index.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
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import process from "node:node:process";
const __dirname = (() => {
const { url: urlStr } = import.meta;
const url = new URL(urlStr);
const __filename = (url.protocol === "file:" ? url.pathname : urlStr)
.replace(/[/][^/]*$/, '');
const isWindows = (() => {
let NATIVE_OS: typeof Deno.build.os = "linux";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const navigator = (globalThis as any).navigator;
if (globalThis.Deno != null) {
NATIVE_OS = Deno.build.os;
} else if (navigator?.appVersion?.includes?.("Win") ?? false) {
NATIVE_OS = "windows";
}
return NATIVE_OS == "windows";
})();
return isWindows ?
__filename.split("/").join("\\").substring(1) :
__filename;
})();
process.once("unhandledRejection", error => {
throw error;
});
console.assert = (condition: any, msg?: string) => {
if (!condition) {
throw new Error(msg);
}
};
import { existsSync } from "node:fs";
import { join } from "node:path";
(async ()=>{
let n = process.argv[2];
if (n) {
require("./test" + n);
} else {
require("../tools/reducers/test");
require("../tools/inDepth/test");
require("../test/test52");
await new Promise(resolve => setTimeout(resolve, 2400));
const n = 110;
console.log({ n });
for (let i = 1; i <= n; i++) {
if( i === 52 ){
continue;
}
const filePath = join(__dirname,"./test" + i);
if( !existsSync(filePath + ".js") ){
continue;
}
try {
require(filePath);
} catch (error) {
console.log(`Fail test ${i}`);
throw error;
}
}
}
})();