Skip to content

Commit

Permalink
fix: bad output name
Browse files Browse the repository at this point in the history
output name was set using full file path. Now only the report filename is used
  • Loading branch information
deblockt authored Apr 19, 2024
1 parent 269d53a commit 6752fe2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
show-global-summary-report: 'true'
- id: check-output
name: "check output for cucumber-report-empty"
if: steps.success-with-empty-cucumber-report.output.cucumber-report-empty_failed_scenarios != 0
if: steps.success-with-empty-cucumber-report.outputs.cucumber-report-empty_failed_scenarios != 0
run: exit 1
- uses: ./
id: job-failed
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12526,6 +12526,7 @@ const glob = __nccwpck_require__(8090);
const fs = __nccwpck_require__(7147);
const reportReaderJson = __nccwpck_require__(8797);
const reportReaderNdJson = __nccwpck_require__(7069);
const path = __nccwpck_require__(1017);

function memoize(fn) {
const cache = {};
Expand Down Expand Up @@ -12617,9 +12618,11 @@ function emojiByStatus(status) {

function setOutput(core, outputName, summaryScenario, summarySteps) {
for (const type in summaryScenario) {
core.debug(`publish output ${outputName}_${type}_scenarios=${summaryScenario[type]}`);
core.setOutput(`${outputName}_${type}_scenarios`, summaryScenario[type]);
}
for (const type in summarySteps) {
core.debug(`publish output ${outputName}_${type}_steps=${summaryScenario[type]}`);
core.setOutput(`${outputName}_${type}_steps`, summaryScenario[type]);
}
}
Expand All @@ -12646,7 +12649,7 @@ function setOutput(core, outputName, summaryScenario, summarySteps) {
for await (const cucumberReportFile of globber.globGenerator()) {
core.info("found cucumber report " + cucumberReportFile);

const reportOutputName = cucumberReportFile.replace(' ', '_').replace('.json', '');
const reportOutputName = path.basename(cucumberReportFile).replace(' ', '_').replace('.json', '');
const reportResultString = await fs.promises.readFile(cucumberReportFile);
const reportResult = (cucumberReportFile.endsWith('.json') ? reportReaderJson : reportReaderNdJson).reader(reportResultString);
const globalInformation = reportResult.globalInformation;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const glob = require("@actions/glob");
const fs = require("fs");
const reportReaderJson = require('./reportReader-json');
const reportReaderNdJson = require('./reportReader-ndjson');
const path = require('path');

function memoize(fn) {
const cache = {};
Expand Down Expand Up @@ -95,9 +96,11 @@ function emojiByStatus(status) {

function setOutput(core, outputName, summaryScenario, summarySteps) {
for (const type in summaryScenario) {
core.debug(`publish output ${outputName}_${type}_scenarios=${summaryScenario[type]}`);
core.setOutput(`${outputName}_${type}_scenarios`, summaryScenario[type]);
}
for (const type in summarySteps) {
core.debug(`publish output ${outputName}_${type}_steps=${summaryScenario[type]}`);
core.setOutput(`${outputName}_${type}_steps`, summaryScenario[type]);
}
}
Expand All @@ -124,7 +127,7 @@ function setOutput(core, outputName, summaryScenario, summarySteps) {
for await (const cucumberReportFile of globber.globGenerator()) {
core.info("found cucumber report " + cucumberReportFile);

const reportOutputName = cucumberReportFile.replace(' ', '_').replace('.json', '');
const reportOutputName = path.basename(cucumberReportFile).replace(' ', '_').replace('.json', '');
const reportResultString = await fs.promises.readFile(cucumberReportFile);
const reportResult = (cucumberReportFile.endsWith('.json') ? reportReaderJson : reportReaderNdJson).reader(reportResultString);
const globalInformation = reportResult.globalInformation;
Expand Down

0 comments on commit 6752fe2

Please sign in to comment.