Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add warning for invalid nunit xml files #286

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions src/model/results-check.ts
Original file line number Diff line number Diff line change
@@ -22,9 +22,18 @@ const ResultsCheck = {
files.map(async filepath => {
if (!filepath.endsWith('.xml')) return;
core.info(`Processing file ${filepath}...`);
const fileData = await ResultsParser.parseResults(path.join(artifactsPath, filepath));
core.info(fileData.summary);
runs.push(fileData);
try {
const content = fs.readFileSync(path.join(artifactsPath, filepath), 'utf8');
if (!content.includes('<test-run')) {
// noinspection ExceptionCaughtLocallyJS
throw new Error('File does not appear to be a NUnit XML file');
}
const fileData = await ResultsParser.parseResults(path.join(artifactsPath, filepath));
core.info(fileData.summary);
runs.push(fileData);
} catch (error: any) {
core.warning(`Failed to parse ${filepath}: ${error.message}`);
}
}),
);

Loading