fix: only push results when the url is set

This commit is contained in:
A.J. Kaptijn 2024-02-09 10:55:38 +01:00
parent 108abd4de9
commit 59060a80a8
2 changed files with 42 additions and 38 deletions

6
dist/index.js generated vendored
View file

@ -192,7 +192,7 @@ class TestReporter {
} }
} }
run() { run() {
var _a; var _a, _b;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (this.workDirInput) { if (this.workDirInput) {
core.info(`Changing directory to '${this.workDirInput}'`); core.info(`Changing directory to '${this.workDirInput}'`);
@ -218,6 +218,7 @@ class TestReporter {
const parser = this.getParser(this.reporter, options); const parser = this.getParser(this.reporter, options);
const results = []; const results = [];
const input = yield inputProvider.load(); const input = yield inputProvider.load();
if (((_a = this.resultsEndpoint) === null || _a === void 0 ? void 0 : _a.length) > 0) {
try { try {
const readStream = input.trxZip.toBuffer(); const readStream = input.trxZip.toBuffer();
const version = fs_1.default.existsSync('test/EVA.TestSuite.Core/bin/Release/version.txt') const version = fs_1.default.existsSync('test/EVA.TestSuite.Core/bin/Release/version.txt')
@ -234,6 +235,7 @@ class TestReporter {
catch (ex) { catch (ex) {
core.warning(`Could not upload TRX ZIP file: ${ex}`); core.warning(`Could not upload TRX ZIP file: ${ex}`);
} }
}
for (const [reportName, files] of Object.entries(input.reports)) { for (const [reportName, files] of Object.entries(input.reports)) {
try { try {
core.startGroup(`Creating test report ${reportName}`); core.startGroup(`Creating test report ${reportName}`);
@ -270,7 +272,7 @@ class TestReporter {
core.endGroup(); core.endGroup();
return; return;
} }
core.info(`${t.name}: ${(_a = t.error) === null || _a === void 0 ? void 0 : _a.message}`); core.info(`${t.name}: ${(_b = t.error) === null || _b === void 0 ? void 0 : _b.message}`);
} }
} }
} }

View file

@ -105,6 +105,7 @@ class TestReporter {
const results: TestRunResultWithUrl[] = [] const results: TestRunResultWithUrl[] = []
const input = await inputProvider.load() const input = await inputProvider.load()
if (this.resultsEndpoint?.length > 0) {
try { try {
const readStream = input.trxZip.toBuffer() const readStream = input.trxZip.toBuffer()
const version = fs.existsSync('test/EVA.TestSuite.Core/bin/Release/version.txt') const version = fs.existsSync('test/EVA.TestSuite.Core/bin/Release/version.txt')
@ -129,6 +130,7 @@ class TestReporter {
} catch (ex) { } catch (ex) {
core.warning(`Could not upload TRX ZIP file: ${ex}`) core.warning(`Could not upload TRX ZIP file: ${ex}`)
} }
}
for (const [reportName, files] of Object.entries(input.reports)) { for (const [reportName, files] of Object.entries(input.reports)) {
try { try {