mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
update to no longer include skipped tests in list
This commit is contained in:
parent
cd976285dc
commit
1a4bb27f01
3 changed files with 38 additions and 12 deletions
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
|
@ -313,11 +313,14 @@ class TestReporter {
|
|||
return yield this.octokit.rest.checks.update(Object.assign(Object.assign({}, requestParams), { output: Object.assign(Object.assign({}, requestParams.output), { annotations }) }));
|
||||
});
|
||||
this.octokit = github.getOctokit(this.token);
|
||||
if (this.listSuites !== 'all' && this.listSuites !== 'failed' && this.listSuites !== 'non-skipped') {
|
||||
if (this.listSuites !== 'all' && this.listSuites !== 'failed') {
|
||||
core.setFailed(`Input parameter 'list-suites' has invalid value of ${this.listSuites}`);
|
||||
return;
|
||||
}
|
||||
if (this.listTests !== 'all' && this.listTests !== 'failed' && this.listTests !== 'none') {
|
||||
if (this.listTests !== 'all' &&
|
||||
this.listTests !== 'failed' &&
|
||||
this.listTests !== 'none' &&
|
||||
this.listTests !== 'non-skipped') {
|
||||
core.setFailed(`Input parameter 'list-tests' has invalid value`);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1689,8 +1692,8 @@ function getSuitesReport(tr, runIndex, options) {
|
|||
const passed = s.passed > 0 ? `${s.passed}${markdown_utils_1.Icon.success}` : '';
|
||||
const failed = s.failed > 0 ? `${s.failed}${markdown_utils_1.Icon.fail}` : '';
|
||||
let skipped;
|
||||
if (options.listSuites === 'non-skipped') {
|
||||
return [tsNameLink, passed, failed, tsTime];
|
||||
if (options.listTests === 'non-skipped') {
|
||||
return [tsNameLink, passed, failed, '', tsTime];
|
||||
}
|
||||
else {
|
||||
skipped = s.skipped > 0 ? `${s.skipped}${markdown_utils_1.Icon.skip}` : '';
|
||||
|
|
@ -1712,6 +1715,12 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
|
|||
if (options.listTests === 'failed' && ts.result !== 'failed') {
|
||||
return [];
|
||||
}
|
||||
// if (ts.result === 'skipped') {
|
||||
// core.info(`SKIPPED TEST LIST ${ts.name}`)
|
||||
// }
|
||||
// if (options.listTests === 'non-skipped' && ts.result === 'skipped') {
|
||||
// return []
|
||||
// }
|
||||
const groups = ts.groups;
|
||||
if (groups.length === 0) {
|
||||
return [];
|
||||
|
|
@ -1729,6 +1738,9 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
|
|||
}
|
||||
const space = grp.name ? ' ' : '';
|
||||
for (const tc of grp.tests) {
|
||||
if (tc.result === 'skipped') {
|
||||
continue;
|
||||
}
|
||||
const result = getResultIcon(tc.result);
|
||||
sections.push(`${space}${result} ${tc.name}`);
|
||||
if (tc.error) {
|
||||
|
|
|
|||
13
src/main.ts
13
src/main.ts
|
|
@ -39,8 +39,8 @@ class TestReporter {
|
|||
readonly path = core.getInput('path', {required: true})
|
||||
readonly pathReplaceBackslashes = core.getInput('path-replace-backslashes', {required: false}) === 'true'
|
||||
readonly reporter = core.getInput('reporter', {required: true})
|
||||
readonly listSuites = core.getInput('list-suites', {required: true}) as 'all' | 'failed' | 'non-skipped'
|
||||
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none'
|
||||
readonly listSuites = core.getInput('list-suites', {required: true}) as 'all' | 'failed'
|
||||
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none' | 'non-skipped'
|
||||
readonly maxAnnotations = parseInt(core.getInput('max-annotations', {required: true}))
|
||||
readonly failOnError = core.getInput('fail-on-error', {required: true}) === 'true'
|
||||
readonly workDirInput = core.getInput('working-directory', {required: false})
|
||||
|
|
@ -53,12 +53,17 @@ class TestReporter {
|
|||
constructor() {
|
||||
this.octokit = github.getOctokit(this.token)
|
||||
|
||||
if (this.listSuites !== 'all' && this.listSuites !== 'failed' && this.listSuites !== 'non-skipped') {
|
||||
if (this.listSuites !== 'all' && this.listSuites !== 'failed') {
|
||||
core.setFailed(`Input parameter 'list-suites' has invalid value of ${this.listSuites}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (this.listTests !== 'all' && this.listTests !== 'failed' && this.listTests !== 'none') {
|
||||
if (
|
||||
this.listTests !== 'all' &&
|
||||
this.listTests !== 'failed' &&
|
||||
this.listTests !== 'none' &&
|
||||
this.listTests !== 'non-skipped'
|
||||
) {
|
||||
core.setFailed(`Input parameter 'list-tests' has invalid value`)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import {slug} from '../utils/slugger'
|
|||
const MAX_REPORT_LENGTH = 65535
|
||||
|
||||
export interface ReportOptions {
|
||||
listSuites: 'all' | 'failed' | 'non-skipped'
|
||||
listTests: 'all' | 'failed' | 'none'
|
||||
listSuites: 'all' | 'failed'
|
||||
listTests: 'all' | 'failed' | 'none' | 'non-skipped'
|
||||
baseUrl: string
|
||||
onlySummary: boolean
|
||||
}
|
||||
|
|
@ -191,8 +191,8 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt
|
|||
const passed = s.passed > 0 ? `${s.passed}${Icon.success}` : ''
|
||||
const failed = s.failed > 0 ? `${s.failed}${Icon.fail}` : ''
|
||||
let skipped
|
||||
if (options.listSuites === 'non-skipped') {
|
||||
return [tsNameLink, passed, failed, tsTime]
|
||||
if (options.listTests === 'non-skipped') {
|
||||
return [tsNameLink, passed, failed, '', tsTime]
|
||||
} else {
|
||||
skipped = s.skipped > 0 ? `${s.skipped}${Icon.skip}` : ''
|
||||
}
|
||||
|
|
@ -217,6 +217,12 @@ function getTestsReport(ts: TestSuiteResult, runIndex: number, suiteIndex: numbe
|
|||
if (options.listTests === 'failed' && ts.result !== 'failed') {
|
||||
return []
|
||||
}
|
||||
// if (ts.result === 'skipped') {
|
||||
// core.info(`SKIPPED TEST LIST ${ts.name}`)
|
||||
// }
|
||||
// if (options.listTests === 'non-skipped' && ts.result === 'skipped') {
|
||||
// return []
|
||||
// }
|
||||
const groups = ts.groups
|
||||
if (groups.length === 0) {
|
||||
return []
|
||||
|
|
@ -237,6 +243,9 @@ function getTestsReport(ts: TestSuiteResult, runIndex: number, suiteIndex: numbe
|
|||
}
|
||||
const space = grp.name ? ' ' : ''
|
||||
for (const tc of grp.tests) {
|
||||
if (tc.result === 'skipped') {
|
||||
continue
|
||||
}
|
||||
const result = getResultIcon(tc.result)
|
||||
sections.push(`${space}${result} ${tc.name}`)
|
||||
if (tc.error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue