forked from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjunit-jest.ts
More file actions
27 lines (26 loc) · 825 Bytes
/
junit-jest.ts
File metadata and controls
27 lines (26 loc) · 825 Bytes
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
import { type ReportMatcher } from '../main';
/**
* Generic matcher for Jest reports in JUnit format.
* @see example ./fixtures/junit-jest.xml
*/
export const junitJestMatcher = {
format: 'xml',
item: '//testcase',
level: {
// Ignore testcase elements that are successful.
ignore: 'not(failure) and not(skipped) and not(error)',
notice: 'skipped',
},
// Select message based on the result type.
message: `
if(error, normalize(concat(error/@message, " \n ", error/text())),
if(skipped, skipped/@message,
normalize(failure/text())
)
)`,
title: '@name',
file: '@file',
// Stack trace usually contains line and column: xxx.spec.yy:line:column
startLine: `match(failure, '.*.spec.\\w{2,3}:(\\d+):.*')`,
startColumn: `match(failure, '.*.spec.\\w{2,3}:\\d+:(\\d+).*')`,
} satisfies ReportMatcher;