-
Notifications
You must be signed in to change notification settings - Fork 1
/
dev
executable file
·61 lines (49 loc) · 1.25 KB
/
dev
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
#!/usr/bin/env node
process.on("unhandledRejection", (error) => {
console.error(error)
process.exit(1)
})
const { run, test, expect, snapshot, info } = require("@xieyuheng/test-runner")
const changeCase = require("change-case")
const path = require("path")
const fs = require("fs")
let commands = {}
commands.t = async () => {
await commands.test_all()
}
commands.test_all = async () => {
await commands.test_lib()
await commands.test_snapshot()
await commands.test_exp()
}
commands.test_lib = async () => {
await test("node $file", { file: "lib/**/*.test.js" }, expect.ok)
}
commands.test_snapshot = async () => {
await test(
"node $file",
{ file: "lib/**/*.snapshot.js" },
snapshot.out(({ file }) =>
path.resolve("snapshot", changeCase.paramCase(file) + ".out")
)
)
}
commands.test_exp = async () => {
await test(
"./bin/exp.js run --no-module $file",
{ file: "tests/**/**.test.exp" },
expect.ok
)
await test(
"./bin/exp.js run --no-module $file",
{ file: "tests/**/**.snapshot.exp" },
snapshot.out(({ file }) => file + ".out")
)
await test(
"./bin/exp.js run --no-module $file",
{ file: "tests/**/**.error.exp" },
snapshot.err(({ file }) => file + ".out")
)
}
info()
run(commands)