blob: d3c1f7b3d956b7ba6422835301868fa270c63e64 (
plain) (
blame)
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
|
const t = ({ colors, err, assert: { equal, deepEqual }}) => ({
assert: {
equal,
deepEqual,
},
tap: x => {
err(`tap: ${x}\n`);
return x;
},
start: msg => {
err(`${msg}:\n`);
},
test: async (msg, fn) => {
err(`${colors.yellow("testing")}: ${msg}... `);
try {
await fn();
} catch (e) {
err(`${colors.red("ERR")}.\n`);
throw e;
}
err(`${colors.green("OK")}.\n`);
},
});
export const runTests = async (conf, tests) => {
const tFinal = t(conf);
for (const testFn of tests) {
await testFn(tFinal);
}
};
|