diff --git a/dist/index.js b/dist/index.js index c397919..f369b5a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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) { diff --git a/src/main.ts b/src/main.ts index d35926d..c09003c 100644 --- a/src/main.ts +++ b/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 } diff --git a/src/report/get-report.ts b/src/report/get-report.ts index ba5ae1e..8fb6102 100644 --- a/src/report/get-report.ts +++ b/src/report/get-report.ts @@ -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) {