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)",
|
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
||||||
"path": "__tests__/main.test.js",
|
"path": "__tests__/main.test.js",
|
||||||
"start_line": 10,
|
"start_line": 10,
|
||||||
"title": "Test Failed: 'Failing test' [__tests__\\\\main.test.js]",
|
"title": "[__tests__\\\\main.test.js] Failing test",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"annotation_level": "failure",
|
"annotation_level": "failure",
|
||||||
|
|
@ -34,7 +34,7 @@ Received: false
|
||||||
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
||||||
"path": "lib/main.js",
|
"path": "lib/main.js",
|
||||||
"start_line": 2,
|
"start_line": 2,
|
||||||
"title": "Test Failed: 'Exception in target unit' [__tests__\\\\main.test.js]",
|
"title": "[__tests__\\\\main.test.js] Exception in target unit",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"annotation_level": "failure",
|
"annotation_level": "failure",
|
||||||
|
|
@ -49,7 +49,7 @@ Received: false
|
||||||
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
at processTicksAndRejections (internal/process/task_queues.js:97:5)",
|
||||||
"path": "__tests__/main.test.js",
|
"path": "__tests__/main.test.js",
|
||||||
"start_line": 21,
|
"start_line": 21,
|
||||||
"title": "Test Failed: 'Exception in test' [__tests__\\\\main.test.js]",
|
"title": "[__tests__\\\\main.test.js] Exception in test",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"annotation_level": "failure",
|
"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)",
|
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",
|
"path": "__tests__/second.test.js",
|
||||||
"start_line": 1,
|
"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.
|
"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 {
|
return {
|
||||||
success,
|
success,
|
||||||
output: {
|
output: {
|
||||||
title: `${junit.testsuites.$.name} ${icon}`,
|
title: `${junit.testsuites.$.name.trim()} ${icon}`,
|
||||||
summary: getSummary(success, junit),
|
summary: getSummary(success, junit),
|
||||||
annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined
|
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 pass = ts.$.tests - fail - skip;
|
||||||
const tm = `${ts.$.time.toFixed(3)}s`;
|
const tm = `${ts.$.time.toFixed(3)}s`;
|
||||||
const result = success ? markdown_utils_1.Icon.success : markdown_utils_1.Icon.fail;
|
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 tsAddr = makeSuiteSlug(i, tsName).link;
|
||||||
const tsNameLink = markdown_utils_1.link(tsName, tsAddr);
|
const tsNameLink = markdown_utils_1.link(tsName, tsAddr);
|
||||||
return [result, tsNameLink, ts.$.tests, tm, pass, fail, skip];
|
return [result, tsNameLink, ts.$.tests, tm, pass, fail, skip];
|
||||||
|
|
@ -168,9 +168,9 @@ function getSuiteSummary(suite, index) {
|
||||||
}
|
}
|
||||||
const content = groups
|
const content = groups
|
||||||
.map(grp => {
|
.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 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 time = `${Math.round(tc.$.time * 1000)}ms`;
|
||||||
const result = getTestCaseIcon(tc);
|
const result = getTestCaseIcon(tc);
|
||||||
return [result, name, time];
|
return [result, name, time];
|
||||||
|
|
@ -178,7 +178,7 @@ function getSuiteSummary(suite, index) {
|
||||||
return `${header}${tests}\n`;
|
return `${header}${tests}\n`;
|
||||||
})
|
})
|
||||||
.join('\n');
|
.join('\n');
|
||||||
const tsName = suite.$.name;
|
const tsName = suite.$.name.trim();
|
||||||
const tsSlug = makeSuiteSlug(index, tsName);
|
const tsSlug = makeSuiteSlug(index, tsName);
|
||||||
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`;
|
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`;
|
||||||
return `## ${tsNameLink} ${icon}\n\n${content}`;
|
return `## ${tsNameLink} ${icon}\n\n${content}`;
|
||||||
|
|
@ -212,7 +212,7 @@ function getAnnotations(junit, workDir, trackedFiles) {
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: ex,
|
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 {
|
return {
|
||||||
success,
|
success,
|
||||||
output: {
|
output: {
|
||||||
title: `${junit.testsuites.$.name} ${icon}`,
|
title: `${junit.testsuites.$.name.trim()} ${icon}`,
|
||||||
summary: getSummary(success, junit),
|
summary: getSummary(success, junit),
|
||||||
annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined
|
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 pass = ts.$.tests - fail - skip
|
||||||
const tm = `${ts.$.time.toFixed(3)}s`
|
const tm = `${ts.$.time.toFixed(3)}s`
|
||||||
const result = success ? Icon.success : Icon.fail
|
const result = success ? Icon.success : Icon.fail
|
||||||
const tsName = ts.$.name
|
const tsName = ts.$.name.trim()
|
||||||
const tsAddr = makeSuiteSlug(i, tsName).link
|
const tsAddr = makeSuiteSlug(i, tsName).link
|
||||||
const tsNameLink = link(tsName, tsAddr)
|
const tsNameLink = link(tsName, tsAddr)
|
||||||
return [result, tsNameLink, ts.$.tests, tm, pass, fail, skip]
|
return [result, tsNameLink, ts.$.tests, tm, pass, fail, skip]
|
||||||
|
|
@ -80,12 +80,12 @@ function getSuiteSummary(suite: TestSuite, index: number): string {
|
||||||
|
|
||||||
const content = groups
|
const content = groups
|
||||||
.map(grp => {
|
.map(grp => {
|
||||||
const header = grp.describe !== '' ? `### ${grp.describe}\n\n` : ''
|
const header = grp.describe !== '' ? `### ${grp.describe.trim()}\n\n` : ''
|
||||||
const tests = table(
|
const tests = table(
|
||||||
['Result', 'Test', 'Time'],
|
['Result', 'Test', 'Time'],
|
||||||
[Align.Center, Align.Left, Align.Right],
|
[Align.Center, Align.Left, Align.Right],
|
||||||
...grp.tests.map(tc => {
|
...grp.tests.map(tc => {
|
||||||
const name = tc.$.name
|
const name = tc.$.name.trim()
|
||||||
const time = `${Math.round(tc.$.time * 1000)}ms`
|
const time = `${Math.round(tc.$.time * 1000)}ms`
|
||||||
const result = getTestCaseIcon(tc)
|
const result = getTestCaseIcon(tc)
|
||||||
return [result, name, time]
|
return [result, name, time]
|
||||||
|
|
@ -96,7 +96,7 @@ function getSuiteSummary(suite: TestSuite, index: number): string {
|
||||||
})
|
})
|
||||||
.join('\n')
|
.join('\n')
|
||||||
|
|
||||||
const tsName = suite.$.name
|
const tsName = suite.$.name.trim()
|
||||||
const tsSlug = makeSuiteSlug(index, tsName)
|
const tsSlug = makeSuiteSlug(index, tsName)
|
||||||
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`
|
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`
|
||||||
return `## ${tsNameLink} ${icon}\n\n${content}`
|
return `## ${tsNameLink} ${icon}\n\n${content}`
|
||||||
|
|
@ -131,7 +131,7 @@ function getAnnotations(junit: JunitReport, workDir: string, trackedFiles: strin
|
||||||
end_line: src.line,
|
end_line: src.line,
|
||||||
path: src.file,
|
path: src.file,
|
||||||
message: ex,
|
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