-
Notifications
You must be signed in to change notification settings - Fork 1
/
toTestResult.js
43 lines (43 loc) · 1.01 KB
/
toTestResult.js
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
module.exports.toTestResult = ({
stats,
skipped,
errorMessage,
tests,
jestTestPath,
}) => {
return {
console: null,
failureMessage: errorMessage,
numFailingTests: stats.failures,
numPassingTests: stats.passes,
numPendingTests: stats.pending,
numTodoTests: stats.todo,
perfStats: {
end: new Date(stats.end).getTime(),
start: new Date(stats.start).getTime(),
},
skipped,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
unmatched: 0,
updated: 0,
},
sourceMaps: {},
testExecError: null,
testFilePath: jestTestPath,
testResults: tests.map(test => {
return {
ancestorTitles: [],
duration: test.duration,
failureMessages: test.errorMessage ? [test.errorMessage] : [],
fullName: test.testPath,
numPassingAsserts: test.errorMessage ? 1 : 0,
status: test.errorMessage ? 'failed' : 'passed',
title: test.title || '',
};
}),
};
};