This commit is contained in:
A. J. Kaptijn 2024-01-16 12:58:19 +01:00
parent 5473a04c5a
commit 21274c9ad7
14 changed files with 110 additions and 110 deletions

122
dist/index.js generated vendored
View file

@ -45,7 +45,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LocalFileProvider = void 0; exports.LocalFileProvider = void 0;
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
const fast_glob_1 = __importDefault(__nccwpck_require__(3664)); const fast_glob_1 = __importDefault(__nccwpck_require__(3664));
const git_js_1 = __nccwpck_require__(9844); const git_1 = __nccwpck_require__(9844);
const adm_zip_1 = __importDefault(__nccwpck_require__(6761)); const adm_zip_1 = __importDefault(__nccwpck_require__(6761));
const path_1 = __importDefault(__nccwpck_require__(1017)); const path_1 = __importDefault(__nccwpck_require__(1017));
class LocalFileProvider { class LocalFileProvider {
@ -76,7 +76,7 @@ class LocalFileProvider {
} }
listTrackedFiles() { listTrackedFiles() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return (0, git_js_1.listFiles)(); return (0, git_1.listFiles)();
}); });
} }
} }
@ -128,12 +128,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
const local_file_provider_js_1 = __nccwpck_require__(9399); const local_file_provider_1 = __nccwpck_require__(9399);
const get_annotations_js_1 = __nccwpck_require__(5867); const get_annotations_1 = __nccwpck_require__(5867);
const get_report_js_1 = __nccwpck_require__(3737); const get_report_1 = __nccwpck_require__(3737);
const dotnet_trx_parser_js_1 = __nccwpck_require__(2664); const dotnet_trx_parser_1 = __nccwpck_require__(2664);
const path_utils_js_1 = __nccwpck_require__(4070); const path_utils_1 = __nccwpck_require__(4070);
const github_utils_js_1 = __nccwpck_require__(3522); const github_utils_1 = __nccwpck_require__(3522);
const webhook_1 = __nccwpck_require__(1095); const webhook_1 = __nccwpck_require__(1095);
const fs_1 = __importDefault(__nccwpck_require__(7147)); const fs_1 = __importDefault(__nccwpck_require__(7147));
const bent_1 = __importDefault(__nccwpck_require__(3113)); const bent_1 = __importDefault(__nccwpck_require__(3113));
@ -170,7 +170,7 @@ class TestReporter {
this.slackWebhook = core.getInput('slack-url', { required: false }); this.slackWebhook = core.getInput('slack-url', { required: false });
this.resultsEndpoint = core.getInput('test-results-endpoint', { required: false }); this.resultsEndpoint = core.getInput('test-results-endpoint', { required: false });
this.resultsEndpointSecret = core.getInput('test-results-endpoint-secret', { required: false }); this.resultsEndpointSecret = core.getInput('test-results-endpoint-secret', { required: false });
this.context = (0, github_utils_js_1.getCheckRunContext)(); this.context = (0, github_utils_1.getCheckRunContext)();
this.octokit = github.getOctokit(this.token); this.octokit = github.getOctokit(this.token);
if (this.listSuites !== 'all' && this.listSuites !== 'failed') { if (this.listSuites !== 'all' && this.listSuites !== 'failed') {
core.setFailed(`Input parameter 'list-suites' has invalid value`); core.setFailed(`Input parameter 'list-suites' has invalid value`);
@ -195,11 +195,11 @@ class TestReporter {
// Split path pattern by ',' and optionally convert all backslashes to forward slashes // Split path pattern by ',' and optionally convert all backslashes to forward slashes
// fast-glob (micromatch) always interprets backslashes as escape characters instead of directory separators // fast-glob (micromatch) always interprets backslashes as escape characters instead of directory separators
const pathsList = this.path.split(','); const pathsList = this.path.split(',');
const pattern = this.pathReplaceBackslashes ? pathsList.map(path_utils_js_1.normalizeFilePath) : pathsList; const pattern = this.pathReplaceBackslashes ? pathsList.map(path_utils_1.normalizeFilePath) : pathsList;
const inputProvider = new local_file_provider_js_1.LocalFileProvider(this.name, pattern); const inputProvider = new local_file_provider_1.LocalFileProvider(this.name, pattern);
const parseErrors = this.maxAnnotations > 0; const parseErrors = this.maxAnnotations > 0;
const trackedFiles = parseErrors ? yield inputProvider.listTrackedFiles() : []; const trackedFiles = parseErrors ? yield inputProvider.listTrackedFiles() : [];
const workDir = this.artifact ? undefined : (0, path_utils_js_1.normalizeDirPath)(process.cwd(), true); const workDir = this.artifact ? undefined : (0, path_utils_1.normalizeDirPath)(process.cwd(), true);
if (parseErrors) if (parseErrors)
core.info(`Found ${trackedFiles.length} files tracked by GitHub`); core.info(`Found ${trackedFiles.length} files tracked by GitHub`);
const options = { const options = {
@ -284,9 +284,9 @@ class TestReporter {
core.info('Creating report summary'); core.info('Creating report summary');
const { listSuites, listTests, onlySummary } = this; const { listSuites, listTests, onlySummary } = this;
const baseUrl = createResp.data.html_url || ''; const baseUrl = createResp.data.html_url || '';
const summary = (0, get_report_js_1.getReport)(results, { listSuites, listTests, baseUrl, onlySummary }); const summary = (0, get_report_1.getReport)(results, { listSuites, listTests, baseUrl, onlySummary });
core.info('Creating annotations'); core.info('Creating annotations');
const annotations = (0, get_annotations_js_1.getAnnotations)(results, this.maxAnnotations); const annotations = (0, get_annotations_1.getAnnotations)(results, this.maxAnnotations);
const isFailed = this.failOnError && results.some(tr => tr.result === 'failed'); const isFailed = this.failOnError && results.some(tr => tr.result === 'failed');
const conclusion = isFailed ? 'failure' : 'success'; const conclusion = isFailed ? 'failure' : 'success';
const passed = results.reduce((sum, tr) => sum + tr.passed, 0); const passed = results.reduce((sum, tr) => sum + tr.passed, 0);
@ -341,7 +341,7 @@ class TestReporter {
getParser(reporter, options) { getParser(reporter, options) {
switch (reporter) { switch (reporter) {
case 'dotnet-trx': case 'dotnet-trx':
return new dotnet_trx_parser_js_1.DotnetTrxParser(options); return new dotnet_trx_parser_1.DotnetTrxParser(options);
default: default:
throw new Error(`Input variable 'reporter' is set to invalid value '${reporter}'`); throw new Error(`Input variable 'reporter' is set to invalid value '${reporter}'`);
} }
@ -369,9 +369,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DotnetTrxParser = void 0; exports.DotnetTrxParser = void 0;
const xml2js_1 = __nccwpck_require__(6189); const xml2js_1 = __nccwpck_require__(6189);
const path_utils_js_1 = __nccwpck_require__(4070); const path_utils_1 = __nccwpck_require__(4070);
const parse_utils_js_1 = __nccwpck_require__(7811); const parse_utils_1 = __nccwpck_require__(7811);
const test_results_js_1 = __nccwpck_require__(2768); const test_results_1 = __nccwpck_require__(2768);
class TestClass { class TestClass {
constructor(name) { constructor(name) {
this.name = name; this.name = name;
@ -443,7 +443,7 @@ class DotnetTrxParser {
} }
const error = this.getErrorInfo(r.result); const error = this.getErrorInfo(r.result);
const durationAttr = r.result.$.duration; const durationAttr = r.result.$.duration;
const duration = durationAttr ? (0, parse_utils_js_1.parseNetDuration)(durationAttr) : 0; const duration = durationAttr ? (0, parse_utils_1.parseNetDuration)(durationAttr) : 0;
const resultTestName = r.result.$.testName; const resultTestName = r.result.$.testName;
const testName = resultTestName.startsWith(className) && resultTestName[className.length] === '.' const testName = resultTestName.startsWith(className) && resultTestName[className.length] === '.'
? resultTestName.substr(className.length + 1) ? resultTestName.substr(className.length + 1)
@ -456,16 +456,16 @@ class DotnetTrxParser {
} }
getTestRunResult(path, trx, testClasses) { getTestRunResult(path, trx, testClasses) {
const times = trx.TestRun.Times[0].$; const times = trx.TestRun.Times[0].$;
const totalTime = (0, parse_utils_js_1.parseIsoDate)(times.finish).getTime() - (0, parse_utils_js_1.parseIsoDate)(times.start).getTime(); const totalTime = (0, parse_utils_1.parseIsoDate)(times.finish).getTime() - (0, parse_utils_1.parseIsoDate)(times.start).getTime();
const suites = testClasses.map(testClass => { const suites = testClasses.map(testClass => {
const tests = testClass.tests.map(test => { const tests = testClass.tests.map(test => {
const error = this.getError(test); const error = this.getError(test);
return new test_results_js_1.TestCaseResult(test.name, test.result, test.duration, error); return new test_results_1.TestCaseResult(test.name, test.result, test.duration, error);
}); });
const group = new test_results_js_1.TestGroupResult(null, tests); const group = new test_results_1.TestGroupResult(null, tests);
return new test_results_js_1.TestSuiteResult(testClass.name, [group]); return new test_results_1.TestSuiteResult(testClass.name, [group]);
}); });
return new test_results_js_1.TestRunResult(path, suites, totalTime); return new test_results_1.TestRunResult(path, suites, totalTime);
} }
getErrorInfo(testResult) { getErrorInfo(testResult) {
var _a; var _a;
@ -511,7 +511,7 @@ class DotnetTrxParser {
const match = str.match(re); const match = str.match(re);
if (match !== null) { if (match !== null) {
const [_, fileStr, lineStr] = match; const [_, fileStr, lineStr] = match;
const filePath = (0, path_utils_js_1.normalizeFilePath)(fileStr); const filePath = (0, path_utils_1.normalizeFilePath)(fileStr);
const workDir = this.getWorkDir(filePath); const workDir = this.getWorkDir(filePath);
if (workDir) { if (workDir) {
const file = filePath.substr(workDir.length); const file = filePath.substr(workDir.length);
@ -525,7 +525,7 @@ class DotnetTrxParser {
} }
getWorkDir(path) { getWorkDir(path) {
var _a, _b; var _a, _b;
return ((_b = (_a = this.options.workDir) !== null && _a !== void 0 ? _a : this.assumedWorkDir) !== null && _b !== void 0 ? _b : (this.assumedWorkDir = (0, path_utils_js_1.getBasePath)(path, this.options.trackedFiles))); return ((_b = (_a = this.options.workDir) !== null && _a !== void 0 ? _a : this.assumedWorkDir) !== null && _b !== void 0 ? _b : (this.assumedWorkDir = (0, path_utils_1.getBasePath)(path, this.options.trackedFiles)));
} }
} }
exports.DotnetTrxParser = DotnetTrxParser; exports.DotnetTrxParser = DotnetTrxParser;
@ -540,8 +540,8 @@ exports.DotnetTrxParser = DotnetTrxParser;
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getAnnotations = void 0; exports.getAnnotations = void 0;
const markdown_utils_js_1 = __nccwpck_require__(6482); const markdown_utils_1 = __nccwpck_require__(6482);
const parse_utils_js_1 = __nccwpck_require__(7811); const parse_utils_1 = __nccwpck_require__(7811);
function getAnnotations(results, maxCount) { function getAnnotations(results, maxCount) {
var _a, _b, _c, _d; var _a, _b, _c, _d;
if (maxCount === 0) { if (maxCount === 0) {
@ -573,7 +573,7 @@ function getAnnotations(results, maxCount) {
suiteName: ts.name, suiteName: ts.name,
testName: tg.name ? `${tg.name}${tc.name}` : tc.name, testName: tg.name ? `${tg.name}${tc.name}` : tc.name,
details: err.details, details: err.details,
message: (_d = (_c = err.message) !== null && _c !== void 0 ? _c : (0, parse_utils_js_1.getFirstNonEmptyLine)(err.details)) !== null && _d !== void 0 ? _d : 'Test failed', message: (_d = (_c = err.message) !== null && _c !== void 0 ? _c : (0, parse_utils_1.getFirstNonEmptyLine)(err.details)) !== null && _d !== void 0 ? _d : 'Test failed',
path, path,
line line
}); });
@ -588,7 +588,7 @@ function getAnnotations(results, maxCount) {
'Failed test found in:', 'Failed test found in:',
e.testRunPaths.map(p => ` ${p}`).join('\n'), e.testRunPaths.map(p => ` ${p}`).join('\n'),
'Error:', 'Error:',
ident((0, markdown_utils_js_1.fixEol)(e.message), ' ') ident((0, markdown_utils_1.fixEol)(e.message), ' ')
].join('\n'); ].join('\n');
return enforceCheckRunLimits({ return enforceCheckRunLimits({
path: e.path, path: e.path,
@ -596,7 +596,7 @@ function getAnnotations(results, maxCount) {
end_line: e.line, end_line: e.line,
annotation_level: 'failure', annotation_level: 'failure',
title: `${e.suiteName}${e.testName}`, title: `${e.suiteName}${e.testName}`,
raw_details: (0, markdown_utils_js_1.fixEol)(e.details), raw_details: (0, markdown_utils_1.fixEol)(e.details),
message message
}); });
}); });
@ -604,10 +604,10 @@ function getAnnotations(results, maxCount) {
} }
exports.getAnnotations = getAnnotations; exports.getAnnotations = getAnnotations;
function enforceCheckRunLimits(err) { function enforceCheckRunLimits(err) {
err.title = (0, markdown_utils_js_1.ellipsis)(err.title || '', 255); err.title = (0, markdown_utils_1.ellipsis)(err.title || '', 255);
err.message = (0, markdown_utils_js_1.ellipsis)(err.message, 65535); err.message = (0, markdown_utils_1.ellipsis)(err.message, 65535);
if (err.raw_details) { if (err.raw_details) {
err.raw_details = (0, markdown_utils_js_1.ellipsis)(err.raw_details, 65535); err.raw_details = (0, markdown_utils_1.ellipsis)(err.raw_details, 65535);
} }
return err; return err;
} }
@ -652,10 +652,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getReport = void 0; exports.getReport = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const node_utils_js_1 = __nccwpck_require__(5824); const node_utils_1 = __nccwpck_require__(5824);
const markdown_utils_js_1 = __nccwpck_require__(6482); const markdown_utils_1 = __nccwpck_require__(6482);
const parse_utils_js_1 = __nccwpck_require__(7811); const parse_utils_1 = __nccwpck_require__(7811);
const slugger_js_1 = __nccwpck_require__(3328); const slugger_1 = __nccwpck_require__(3328);
const MAX_REPORT_LENGTH = 65535; const MAX_REPORT_LENGTH = 65535;
const defaultOptions = { const defaultOptions = {
listSuites: 'all', listSuites: 'all',
@ -721,9 +721,9 @@ function trimReport(lines) {
return reportLines.join('\n'); return reportLines.join('\n');
} }
function applySort(results) { function applySort(results) {
results.sort((a, b) => a.path.localeCompare(b.path, node_utils_js_1.DEFAULT_LOCALE)); results.sort((a, b) => a.path.localeCompare(b.path, node_utils_1.DEFAULT_LOCALE));
for (const res of results) { for (const res of results) {
res.suites.sort((a, b) => a.name.localeCompare(b.name, node_utils_js_1.DEFAULT_LOCALE)); res.suites.sort((a, b) => a.name.localeCompare(b.name, node_utils_1.DEFAULT_LOCALE));
} }
} }
function getByteLength(text) { function getByteLength(text) {
@ -770,17 +770,17 @@ function getTestRunsReport(testRuns, options) {
const sections = []; const sections = [];
if (testRuns.length > 1 || options.onlySummary) { if (testRuns.length > 1 || options.onlySummary) {
const tableData = testRuns.map((tr, runIndex) => { const tableData = testRuns.map((tr, runIndex) => {
const time = (0, markdown_utils_js_1.formatTime)(tr.time); const time = (0, markdown_utils_1.formatTime)(tr.time);
const folder = tr.path.indexOf('/TestResults/'); const folder = tr.path.indexOf('/TestResults/');
const name = folder > 0 ? tr.path.slice(0, folder) : tr.path; const name = folder > 0 ? tr.path.slice(0, folder) : tr.path;
const addr = options.baseUrl + makeRunSlug(runIndex).link; const addr = options.baseUrl + makeRunSlug(runIndex).link;
const nameLink = (0, markdown_utils_js_1.link)(name, addr); const nameLink = (0, markdown_utils_1.link)(name, addr);
const passed = tr.passed > 0 ? `${tr.passed}${markdown_utils_js_1.Icon.success}` : ''; const passed = tr.passed > 0 ? `${tr.passed}${markdown_utils_1.Icon.success}` : '';
const failed = tr.failed > 0 ? `${tr.failed}${markdown_utils_js_1.Icon.fail}` : ''; const failed = tr.failed > 0 ? `${tr.failed}${markdown_utils_1.Icon.fail}` : '';
const skipped = tr.skipped > 0 ? `${tr.skipped}${markdown_utils_js_1.Icon.skip}` : ''; const skipped = tr.skipped > 0 ? `${tr.skipped}${markdown_utils_1.Icon.skip}` : '';
return [nameLink, passed, failed, skipped, time]; return [nameLink, passed, failed, skipped, time];
}); });
const resultsTable = (0, markdown_utils_js_1.table)(['Report', 'Passed', 'Failed', 'Skipped', 'Time'], [markdown_utils_js_1.Align.Left, markdown_utils_js_1.Align.Right, markdown_utils_js_1.Align.Right, markdown_utils_js_1.Align.Right, markdown_utils_js_1.Align.Right], ...tableData); const resultsTable = (0, markdown_utils_1.table)(['Report', 'Passed', 'Failed', 'Skipped', 'Time'], [markdown_utils_1.Align.Left, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right], ...tableData);
sections.push(resultsTable); sections.push(resultsTable);
} }
if (options.onlySummary === false) { if (options.onlySummary === false) {
@ -797,22 +797,22 @@ function getSuitesReport(tr, runIndex, options) {
const nameLink = `<a id="${trSlug.id}" href="${options.baseUrl + trSlug.link}">${name}</a>`; const nameLink = `<a id="${trSlug.id}" href="${options.baseUrl + trSlug.link}">${name}</a>`;
const icon = getResultIcon(tr.result); const icon = getResultIcon(tr.result);
sections.push(`## ${icon}\xa0${nameLink}`); sections.push(`## ${icon}\xa0${nameLink}`);
const time = (0, markdown_utils_js_1.formatTime)(tr.time); const time = (0, markdown_utils_1.formatTime)(tr.time);
const headingLine2 = tr.tests > 0 const headingLine2 = tr.tests > 0
? `**${tr.tests}** tests were completed in **${time}** with **${tr.passed}** passed, **${tr.failed}** failed and **${tr.skipped}** skipped.` ? `**${tr.tests}** tests were completed in **${time}** with **${tr.passed}** passed, **${tr.failed}** failed and **${tr.skipped}** skipped.`
: 'No tests found'; : 'No tests found';
sections.push(headingLine2); sections.push(headingLine2);
const suites = options.listSuites === 'failed' ? tr.failedSuites : tr.suites; const suites = options.listSuites === 'failed' ? tr.failedSuites : tr.suites;
if (suites.length > 0) { if (suites.length > 0) {
const suitesTable = (0, markdown_utils_js_1.table)(['Test suite', 'Passed', 'Failed', 'Skipped', 'Time'], [markdown_utils_js_1.Align.Left, markdown_utils_js_1.Align.Right, markdown_utils_js_1.Align.Right, markdown_utils_js_1.Align.Right, markdown_utils_js_1.Align.Right], ...suites.map((s, suiteIndex) => { const suitesTable = (0, markdown_utils_1.table)(['Test suite', 'Passed', 'Failed', 'Skipped', 'Time'], [markdown_utils_1.Align.Left, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right], ...suites.map((s, suiteIndex) => {
const tsTime = (0, markdown_utils_js_1.formatTime)(s.time); const tsTime = (0, markdown_utils_1.formatTime)(s.time);
const tsName = s.name.startsWith(name) ? s.name.slice(name.length + 1) : s.name; const tsName = s.name.startsWith(name) ? s.name.slice(name.length + 1) : s.name;
const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed'); const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed');
const tsAddr = options.baseUrl + makeSuiteSlug(runIndex, suiteIndex).link; const tsAddr = options.baseUrl + makeSuiteSlug(runIndex, suiteIndex).link;
const tsNameLink = skipLink ? tsName : (0, markdown_utils_js_1.link)(tsName, tsAddr); const tsNameLink = skipLink ? tsName : (0, markdown_utils_1.link)(tsName, tsAddr);
const passed = s.passed > 0 ? `${s.passed}${markdown_utils_js_1.Icon.success}` : ''; const passed = s.passed > 0 ? `${s.passed}${markdown_utils_1.Icon.success}` : '';
const failed = s.failed > 0 ? `${s.failed}${markdown_utils_js_1.Icon.fail}` : ''; const failed = s.failed > 0 ? `${s.failed}${markdown_utils_1.Icon.fail}` : '';
const skipped = s.skipped > 0 ? `${s.skipped}${markdown_utils_js_1.Icon.skip}` : ''; const skipped = s.skipped > 0 ? `${s.skipped}${markdown_utils_1.Icon.skip}` : '';
return [tsNameLink, passed, failed, skipped, tsTime]; return [tsNameLink, passed, failed, skipped, tsTime];
})); }));
sections.push(suitesTable); sections.push(suitesTable);
@ -850,7 +850,7 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
const result = getResultIcon(tc.result); const result = getResultIcon(tc.result);
sections.push(`${space}${result} ${tc.name}`); sections.push(`${space}${result} ${tc.name}`);
if (tc.error) { if (tc.error) {
const lines = (_c = ((_a = tc.error.message) !== null && _a !== void 0 ? _a : (_b = (0, parse_utils_js_1.getFirstNonEmptyLine)(tc.error.details)) === null || _b === void 0 ? void 0 : _b.trim())) === null || _c === void 0 ? void 0 : _c.split(/\r?\n/g).map(l => '\t' + l); const lines = (_c = ((_a = tc.error.message) !== null && _a !== void 0 ? _a : (_b = (0, parse_utils_1.getFirstNonEmptyLine)(tc.error.details)) === null || _b === void 0 ? void 0 : _b.trim())) === null || _c === void 0 ? void 0 : _c.split(/\r?\n/g).map(l => '\t' + l);
if (lines) { if (lines) {
sections.push(...lines); sections.push(...lines);
} }
@ -862,20 +862,20 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
} }
function makeRunSlug(runIndex) { function makeRunSlug(runIndex) {
// use prefix to avoid slug conflicts after escaping the paths // use prefix to avoid slug conflicts after escaping the paths
return (0, slugger_js_1.slug)(`r${runIndex}`); return (0, slugger_1.slug)(`r${runIndex}`);
} }
function makeSuiteSlug(runIndex, suiteIndex) { function makeSuiteSlug(runIndex, suiteIndex) {
// use prefix to avoid slug conflicts after escaping the paths // use prefix to avoid slug conflicts after escaping the paths
return (0, slugger_js_1.slug)(`r${runIndex}s${suiteIndex}`); return (0, slugger_1.slug)(`r${runIndex}s${suiteIndex}`);
} }
function getResultIcon(result) { function getResultIcon(result) {
switch (result) { switch (result) {
case 'success': case 'success':
return markdown_utils_js_1.Icon.success; return markdown_utils_1.Icon.success;
case 'skipped': case 'skipped':
return markdown_utils_js_1.Icon.skip; return markdown_utils_1.Icon.skip;
case 'failed': case 'failed':
return markdown_utils_js_1.Icon.fail; return markdown_utils_1.Icon.fail;
default: default:
return ''; return '';
} }
@ -1296,7 +1296,7 @@ exports.formatTime = formatTime;
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getExceptionSource = exports.DEFAULT_LOCALE = void 0; exports.getExceptionSource = exports.DEFAULT_LOCALE = void 0;
const path_utils_js_1 = __nccwpck_require__(4070); const path_utils_1 = __nccwpck_require__(4070);
exports.DEFAULT_LOCALE = 'en-US'; exports.DEFAULT_LOCALE = 'en-US';
function getExceptionSource(stackTrace, trackedFiles, getRelativePath) { function getExceptionSource(stackTrace, trackedFiles, getRelativePath) {
const lines = stackTrace.split(/\r?\n/); const lines = stackTrace.split(/\r?\n/);
@ -1305,7 +1305,7 @@ function getExceptionSource(stackTrace, trackedFiles, getRelativePath) {
const match = str.match(re); const match = str.match(re);
if (match !== null) { if (match !== null) {
const [_, fileStr, lineStr] = match; const [_, fileStr, lineStr] = match;
const filePath = (0, path_utils_js_1.normalizeFilePath)(fileStr); const filePath = (0, path_utils_1.normalizeFilePath)(fileStr);
if (filePath.startsWith('internal/') || filePath.includes('/node_modules/')) { if (filePath.startsWith('internal/') || filePath.includes('/node_modules/')) {
continue; continue;
} }

View file

@ -1,7 +1,7 @@
import * as fs from 'fs' import * as fs from 'fs'
import glob from 'fast-glob' import glob from 'fast-glob'
import {FileContent, InputProvider, ReportInput} from './input-provider.js' import {FileContent, InputProvider, ReportInput} from './input-provider'
import {listFiles} from '../utils/git.js' import {listFiles} from '../utils/git'
import Zip from 'adm-zip' import Zip from 'adm-zip'
import path from 'path' import path from 'path'

View file

@ -1,18 +1,18 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import {GitHub} from '@actions/github/lib/utils.js' import {GitHub} from '@actions/github/lib/utils'
import {LocalFileProvider} from './input-providers/local-file-provider.js' import {LocalFileProvider} from './input-providers/local-file-provider'
import {FileContent} from './input-providers/input-provider.js' import {FileContent} from './input-providers/input-provider'
import {ParseOptions, TestParser} from './test-parser.js' import {ParseOptions, TestParser} from './test-parser'
import {TestRunResult} from './test-results.js' import {TestRunResult} from './test-results'
import {getAnnotations} from './report/get-annotations.js' import {getAnnotations} from './report/get-annotations'
import {getReport} from './report/get-report.js' import {getReport} from './report/get-report'
import {DotnetTrxParser} from './parsers/dotnet-trx/dotnet-trx-parser.js' import {DotnetTrxParser} from './parsers/dotnet-trx/dotnet-trx-parser'
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils.js' import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
import {getCheckRunContext} from './utils/github-utils.js' import {getCheckRunContext} from './utils/github-utils'
import {IncomingWebhook} from '@slack/webhook' import {IncomingWebhook} from '@slack/webhook'
import fs from 'fs' import fs from 'fs'
import bent from 'bent' import bent from 'bent'

View file

@ -1,6 +1,6 @@
import {ParseOptions, TestParser} from '../../test-parser.js' import {ParseOptions, TestParser} from '../../test-parser'
import {getBasePath, normalizeFilePath} from '../../utils/path-utils.js' import {getBasePath, normalizeFilePath} from '../../utils/path-utils'
import { import {
ReportEvent, ReportEvent,
@ -17,7 +17,7 @@ import {
isDoneEvent, isDoneEvent,
isMessageEvent, isMessageEvent,
MessageEvent MessageEvent
} from './dart-json-types.js' } from './dart-json-types'
import { import {
TestExecutionResult, TestExecutionResult,
@ -26,7 +26,7 @@ import {
TestGroupResult, TestGroupResult,
TestCaseResult, TestCaseResult,
TestCaseError TestCaseError
} from '../../test-results.js' } from '../../test-results'
class TestRun { class TestRun {
constructor( constructor(

View file

@ -1,10 +1,10 @@
import {parseStringPromise} from 'xml2js' import {parseStringPromise} from 'xml2js'
import {ErrorInfo, Outcome, TrxReport, UnitTest, UnitTestResult} from './dotnet-trx-types.js' import {ErrorInfo, Outcome, TrxReport, UnitTest, UnitTestResult} from './dotnet-trx-types'
import {ParseOptions, TestParser} from '../../test-parser.js' import {ParseOptions, TestParser} from '../../test-parser'
import {getBasePath, normalizeFilePath} from '../../utils/path-utils.js' import {getBasePath, normalizeFilePath} from '../../utils/path-utils'
import {parseIsoDate, parseNetDuration} from '../../utils/parse-utils.js' import {parseIsoDate, parseNetDuration} from '../../utils/parse-utils'
import { import {
TestExecutionResult, TestExecutionResult,
@ -13,7 +13,7 @@ import {
TestGroupResult, TestGroupResult,
TestCaseResult, TestCaseResult,
TestCaseError TestCaseError
} from '../../test-results.js' } from '../../test-results'
class TestClass { class TestClass {
constructor(readonly name: string) {} constructor(readonly name: string) {}

View file

@ -1,10 +1,10 @@
import * as path from 'path' import * as path from 'path'
import {ParseOptions, TestParser} from '../../test-parser.js' import {ParseOptions, TestParser} from '../../test-parser'
import {parseStringPromise} from 'xml2js' import {parseStringPromise} from 'xml2js'
import {parseStackTraceElement} from './java-stack-trace-element-parser.js' import {parseStackTraceElement} from './java-stack-trace-element-parser'
import {JunitReport, SingleSuiteReport, TestCase, TestSuite} from './java-junit-types.js' import {JunitReport, SingleSuiteReport, TestCase, TestSuite} from './java-junit-types'
import {normalizeFilePath} from '../../utils/path-utils.js' import {normalizeFilePath} from '../../utils/path-utils'
import { import {
TestExecutionResult, TestExecutionResult,
@ -13,7 +13,7 @@ import {
TestGroupResult, TestGroupResult,
TestCaseResult, TestCaseResult,
TestCaseError TestCaseError
} from '../../test-results.js' } from '../../test-results'
export class JavaJunitParser implements TestParser { export class JavaJunitParser implements TestParser {
readonly trackedFiles: {[fileName: string]: string[]} readonly trackedFiles: {[fileName: string]: string[]}

View file

@ -1,9 +1,9 @@
import {ParseOptions, TestParser} from '../../test-parser.js' import {ParseOptions, TestParser} from '../../test-parser'
import {parseStringPromise} from 'xml2js' import {parseStringPromise} from 'xml2js'
import {JunitReport, TestCase, TestSuite} from './jest-junit-types.js' import {JunitReport, TestCase, TestSuite} from './jest-junit-types'
import {getExceptionSource} from '../../utils/node-utils.js' import {getExceptionSource} from '../../utils/node-utils'
import {getBasePath, normalizeFilePath} from '../../utils/path-utils.js' import {getBasePath, normalizeFilePath} from '../../utils/path-utils'
import { import {
TestExecutionResult, TestExecutionResult,
@ -12,7 +12,7 @@ import {
TestGroupResult, TestGroupResult,
TestCaseResult, TestCaseResult,
TestCaseError TestCaseError
} from '../../test-results.js' } from '../../test-results'
export class JestJunitParser implements TestParser { export class JestJunitParser implements TestParser {
assumedWorkDir: string | undefined assumedWorkDir: string | undefined

View file

@ -1,4 +1,4 @@
import {ParseOptions, TestParser} from '../../test-parser.js' import {ParseOptions, TestParser} from '../../test-parser'
import { import {
TestCaseError, TestCaseError,
TestCaseResult, TestCaseResult,
@ -6,10 +6,10 @@ import {
TestGroupResult, TestGroupResult,
TestRunResult, TestRunResult,
TestSuiteResult TestSuiteResult
} from '../../test-results.js' } from '../../test-results'
import {getExceptionSource} from '../../utils/node-utils.js' import {getExceptionSource} from '../../utils/node-utils'
import {getBasePath, normalizeFilePath} from '../../utils/path-utils.js' import {getBasePath, normalizeFilePath} from '../../utils/path-utils'
import {MochaJson, MochaJsonTest} from './mocha-json-types.js' import {MochaJson, MochaJsonTest} from './mocha-json-types'
export class MochaJsonParser implements TestParser { export class MochaJsonParser implements TestParser {
assumedWorkDir: string | undefined assumedWorkDir: string | undefined

View file

@ -1,5 +1,5 @@
import {ParseOptions} from '../../test-parser.js' import {ParseOptions} from '../../test-parser'
import {JavaJunitParser} from '../java-junit/java-junit-parser.js' import {JavaJunitParser} from '../java-junit/java-junit-parser'
export class SwiftXunitParser extends JavaJunitParser { export class SwiftXunitParser extends JavaJunitParser {
constructor(readonly options: ParseOptions) { constructor(readonly options: ParseOptions) {

View file

@ -1,6 +1,6 @@
import {ellipsis, fixEol} from '../utils/markdown-utils.js' import {ellipsis, fixEol} from '../utils/markdown-utils'
import {TestRunResult} from '../test-results.js' import {TestRunResult} from '../test-results'
import {getFirstNonEmptyLine} from '../utils/parse-utils.js' import {getFirstNonEmptyLine} from '../utils/parse-utils'
type Annotation = { type Annotation = {
path: string path: string

View file

@ -1,9 +1,9 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {DEFAULT_LOCALE} from '../utils/node-utils.js' import {DEFAULT_LOCALE} from '../utils/node-utils'
import {TestExecutionResult, TestRunResult, TestSuiteResult} from '../test-results.js' import {TestExecutionResult, TestRunResult, TestSuiteResult} from '../test-results'
import {Align, formatTime, Icon, link, table} from '../utils/markdown-utils.js' import {Align, formatTime, Icon, link, table} from '../utils/markdown-utils'
import {getFirstNonEmptyLine} from '../utils/parse-utils.js' import {getFirstNonEmptyLine} from '../utils/parse-utils'
import {slug} from '../utils/slugger.js' import {slug} from '../utils/slugger'
const MAX_REPORT_LENGTH = 65535 const MAX_REPORT_LENGTH = 65535

View file

@ -1,4 +1,4 @@
import {TestRunResult} from './test-results.js' import {TestRunResult} from './test-results'
export interface ParseOptions { export interface ParseOptions {
parseErrors: boolean parseErrors: boolean

View file

@ -1,7 +1,7 @@
import {createWriteStream} from 'fs' import {createWriteStream} from 'fs'
import * as core from '@actions/core' import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import {GitHub} from '@actions/github/lib/utils.js' import {GitHub} from '@actions/github/lib/utils'
import * as stream from 'stream' import * as stream from 'stream'
import {promisify} from 'util' import {promisify} from 'util'
import got from 'got' import got from 'got'

View file

@ -1,4 +1,4 @@
import {normalizeFilePath} from './path-utils.js' import {normalizeFilePath} from './path-utils'
export const DEFAULT_LOCALE = 'en-US' export const DEFAULT_LOCALE = 'en-US'