mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Put only test filename and test case name into annotation title
This commit is contained in:
parent
198c3d1af3
commit
d071a83e6a
4 changed files with 17 additions and 17 deletions
|
|
@ -18,7 +18,7 @@ Received: false
|
|||
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
||||
"path": "__tests__/main.test.js",
|
||||
"start_line": 10,
|
||||
"title": "Test Failed: 'Failing test' [__tests__\\\\main.test.js]",
|
||||
"title": "[__tests__\\\\main.test.js] Failing test",
|
||||
},
|
||||
Object {
|
||||
"annotation_level": "failure",
|
||||
|
|
@ -34,7 +34,7 @@ Received: false
|
|||
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
||||
"path": "lib/main.js",
|
||||
"start_line": 2,
|
||||
"title": "Test Failed: 'Exception in target unit' [__tests__\\\\main.test.js]",
|
||||
"title": "[__tests__\\\\main.test.js] Exception in target unit",
|
||||
},
|
||||
Object {
|
||||
"annotation_level": "failure",
|
||||
|
|
@ -49,7 +49,7 @@ Received: false
|
|||
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
||||
"path": "__tests__/main.test.js",
|
||||
"start_line": 21,
|
||||
"title": "Test Failed: 'Exception in test' [__tests__\\\\main.test.js]",
|
||||
"title": "[__tests__\\\\main.test.js] Exception in test",
|
||||
},
|
||||
Object {
|
||||
"annotation_level": "failure",
|
||||
|
|
@ -70,7 +70,7 @@ Received: false
|
|||
at runTest (C:\\\\Users\\\\Michal\\\\Workspace\\\\dorny\\\\test-check\\\\reports\\\\jest\\\\node_modules\\\\jest-runner\\\\build\\\\runTest.js:472:34)",
|
||||
"path": "__tests__/second.test.js",
|
||||
"start_line": 1,
|
||||
"title": "Test Failed: 'Timeout test' [__tests__\\\\second.test.js]",
|
||||
"title": "[__tests__\\\\second.test.js] Timeout test",
|
||||
},
|
||||
],
|
||||
"summary": "**6** tests were completed in **1.360s** with **1** passed, **1** skipped and **4** failed.
|
||||
|
|
|
|||
12
dist/index.js
generated
vendored
12
dist/index.js
generated
vendored
|
|
@ -119,7 +119,7 @@ async function parseJestJunit(content, options) {
|
|||
return {
|
||||
success,
|
||||
output: {
|
||||
title: `${junit.testsuites.$.name} ${icon}`,
|
||||
title: `${junit.testsuites.$.name.trim()} ${icon}`,
|
||||
summary: getSummary(success, junit),
|
||||
annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ function getSummary(success, junit) {
|
|||
const pass = ts.$.tests - fail - skip;
|
||||
const tm = `${ts.$.time.toFixed(3)}s`;
|
||||
const result = success ? markdown_utils_1.Icon.success : markdown_utils_1.Icon.fail;
|
||||
const tsName = ts.$.name;
|
||||
const tsName = ts.$.name.trim();
|
||||
const tsAddr = makeSuiteSlug(i, tsName).link;
|
||||
const tsNameLink = markdown_utils_1.link(tsName, tsAddr);
|
||||
return [result, tsNameLink, ts.$.tests, tm, pass, fail, skip];
|
||||
|
|
@ -168,9 +168,9 @@ function getSuiteSummary(suite, index) {
|
|||
}
|
||||
const content = groups
|
||||
.map(grp => {
|
||||
const header = grp.describe !== '' ? `### ${grp.describe}\n\n` : '';
|
||||
const header = grp.describe !== '' ? `### ${grp.describe.trim()}\n\n` : '';
|
||||
const tests = markdown_utils_1.table(['Result', 'Test', 'Time'], [markdown_utils_1.Align.Center, markdown_utils_1.Align.Left, markdown_utils_1.Align.Right], ...grp.tests.map(tc => {
|
||||
const name = tc.$.name;
|
||||
const name = tc.$.name.trim();
|
||||
const time = `${Math.round(tc.$.time * 1000)}ms`;
|
||||
const result = getTestCaseIcon(tc);
|
||||
return [result, name, time];
|
||||
|
|
@ -178,7 +178,7 @@ function getSuiteSummary(suite, index) {
|
|||
return `${header}${tests}\n`;
|
||||
})
|
||||
.join('\n');
|
||||
const tsName = suite.$.name;
|
||||
const tsName = suite.$.name.trim();
|
||||
const tsSlug = makeSuiteSlug(index, tsName);
|
||||
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`;
|
||||
return `## ${tsNameLink} ${icon}\n\n${content}`;
|
||||
|
|
@ -212,7 +212,7 @@ function getAnnotations(junit, workDir, trackedFiles) {
|
|||
end_line: src.line,
|
||||
path: src.file,
|
||||
message: ex,
|
||||
title: `Test Failed: '${tc.$.name}' [${suite.$.name}]`
|
||||
title: `[${suite.$.name}] ${tc.$.name.trim()}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@ export async function parseJestJunit(content: string, options: ParseOptions): Pr
|
|||
return {
|
||||
success,
|
||||
output: {
|
||||
title: `${junit.testsuites.$.name} ${icon}`,
|
||||
title: `${junit.testsuites.$.name.trim()} ${icon}`,
|
||||
summary: getSummary(success, junit),
|
||||
annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ function getSummary(success: boolean, junit: JunitReport): string {
|
|||
const pass = ts.$.tests - fail - skip
|
||||
const tm = `${ts.$.time.toFixed(3)}s`
|
||||
const result = success ? Icon.success : Icon.fail
|
||||
const tsName = ts.$.name
|
||||
const tsName = ts.$.name.trim()
|
||||
const tsAddr = makeSuiteSlug(i, tsName).link
|
||||
const tsNameLink = link(tsName, tsAddr)
|
||||
return [result, tsNameLink, ts.$.tests, tm, pass, fail, skip]
|
||||
|
|
@ -80,12 +80,12 @@ function getSuiteSummary(suite: TestSuite, index: number): string {
|
|||
|
||||
const content = groups
|
||||
.map(grp => {
|
||||
const header = grp.describe !== '' ? `### ${grp.describe}\n\n` : ''
|
||||
const header = grp.describe !== '' ? `### ${grp.describe.trim()}\n\n` : ''
|
||||
const tests = table(
|
||||
['Result', 'Test', 'Time'],
|
||||
[Align.Center, Align.Left, Align.Right],
|
||||
...grp.tests.map(tc => {
|
||||
const name = tc.$.name
|
||||
const name = tc.$.name.trim()
|
||||
const time = `${Math.round(tc.$.time * 1000)}ms`
|
||||
const result = getTestCaseIcon(tc)
|
||||
return [result, name, time]
|
||||
|
|
@ -96,7 +96,7 @@ function getSuiteSummary(suite: TestSuite, index: number): string {
|
|||
})
|
||||
.join('\n')
|
||||
|
||||
const tsName = suite.$.name
|
||||
const tsName = suite.$.name.trim()
|
||||
const tsSlug = makeSuiteSlug(index, tsName)
|
||||
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`
|
||||
return `## ${tsNameLink} ${icon}\n\n${content}`
|
||||
|
|
@ -131,7 +131,7 @@ function getAnnotations(junit: JunitReport, workDir: string, trackedFiles: strin
|
|||
end_line: src.line,
|
||||
path: src.file,
|
||||
message: ex,
|
||||
title: `Test Failed: '${tc.$.name}' [${suite.$.name}]`
|
||||
title: `[${suite.$.name}] ${tc.$.name.trim()}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue