forked from TypeScriptToLua/TypeScriptToLua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_thread.ts
More file actions
36 lines (32 loc) · 1.17 KB
/
test_thread.ts
File metadata and controls
36 lines (32 loc) · 1.17 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 { MatchError, TestRunner, TestSet, TestOutcome } from "alsatian";
import * as flatted from "flatted";
module.exports = (input, done) => {
const testSet = TestSet.create();
testSet.addTestsFromFiles(input.files);
const testRunner = new TestRunner();
let testCount = 0;
let failedTestCount = 0;
testRunner.onTestComplete(result => {
if (result.outcome === TestOutcome.Fail) {
if (result.error instanceof MatchError) {
console.log(`Test ${result.testFixture.description}, ${result.test.key}(${flatted.stringify(result.testCase.caseArguments)}) Failed!`);
console.log(" ---\n" +
' message: "' +
result.error.message +
'"\n' +
" severity: fail\n" +
" data:\n" +
" got: " +
result.error.actual +
"\n" +
" expect: " +
result.error.expected +
"\n");
}
failedTestCount++;
}
testCount++;
});
testRunner.run(testSet)
.then(() => done(testCount, failedTestCount));
};