|
1 | | -const toTestResult = ({ |
| 1 | +module.exports = function toTestResult({ |
2 | 2 | stats, |
3 | 3 | skipped, |
4 | 4 | errorMessage, |
5 | 5 | tests, |
6 | 6 | jestTestPath, |
7 | | -}) => ({ |
8 | | - console: null, |
9 | | - failureMessage: errorMessage, |
10 | | - numFailingTests: stats.failures, |
11 | | - numPassingTests: stats.passes, |
12 | | - numPendingTests: stats.pending, |
13 | | - numTodoTests: stats.todo, |
14 | | - perfStats: { |
15 | | - end: new Date(stats.end).getTime(), |
16 | | - start: new Date(stats.start).getTime(), |
17 | | - }, |
18 | | - skipped, |
19 | | - snapshot: { |
20 | | - added: 0, |
21 | | - fileDeleted: false, |
22 | | - matched: 0, |
23 | | - unchecked: 0, |
24 | | - unmatched: 0, |
25 | | - updated: 0, |
26 | | - }, |
27 | | - sourceMaps: {}, |
28 | | - testExecError: null, |
29 | | - testFilePath: jestTestPath, |
30 | | - testResults: tests.map((test) => ({ |
31 | | - ancestorTitles: [], |
32 | | - duration: test.duration, |
33 | | - failureMessages: [test.errorMessage], |
34 | | - fullName: test.testPath, |
35 | | - numPassingAsserts: test.errorMessage ? 1 : 0, |
36 | | - status: test.errorMessage ? 'failed' : 'passed', |
37 | | - title: test.title || '', |
38 | | - })), |
39 | | -}); |
40 | | - |
41 | | -export default toTestResult; |
| 7 | +}) { |
| 8 | + return { |
| 9 | + console: null, |
| 10 | + failureMessage: errorMessage, |
| 11 | + numFailingTests: stats.failures, |
| 12 | + numPassingTests: stats.passes, |
| 13 | + numPendingTests: stats.pending, |
| 14 | + numTodoTests: stats.todo, |
| 15 | + perfStats: { |
| 16 | + end: new Date(stats.end).getTime(), |
| 17 | + start: new Date(stats.start).getTime(), |
| 18 | + }, |
| 19 | + skipped, |
| 20 | + snapshot: { |
| 21 | + added: 0, |
| 22 | + fileDeleted: false, |
| 23 | + matched: 0, |
| 24 | + unchecked: 0, |
| 25 | + unmatched: 0, |
| 26 | + updated: 0, |
| 27 | + }, |
| 28 | + sourceMaps: {}, |
| 29 | + testExecError: null, |
| 30 | + testFilePath: jestTestPath, |
| 31 | + testResults: tests.map((test) => ({ |
| 32 | + ancestorTitles: [], |
| 33 | + duration: test.duration, |
| 34 | + failureMessages: [test.errorMessage], |
| 35 | + fullName: test.testPath, |
| 36 | + numPassingAsserts: test.errorMessage ? 1 : 0, |
| 37 | + status: test.errorMessage ? 'failed' : 'passed', |
| 38 | + title: test.title || '', |
| 39 | + })), |
| 40 | + }; |
| 41 | +}; |
0 commit comments