Skip to content

Commit

Permalink
change output strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Jan 31, 2025
1 parent e211b69 commit 967ed0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
11 changes: 5 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31659,8 +31659,8 @@ function getTestCaseDetails(testCase) {
}
details += `\`\`\`\n`;
}
const utps = (0, parser_1.parseUtp)(testCase['output']);
const outputLines = utps.map((utp) => {
const utpOutput = (0, parser_1.parseUtp)(testCase['output']);
utpOutput.map((utp) => {
core.debug(JSON.stringify(utp, null, 2));
if (utp.type === 'TestStatus' && utp.phase === 'End' && utp.state === 5) {
const unityProjectPath = `${process_1.env['UNITY_PROJECT_PATH'] || ''}/`;
Expand All @@ -31673,13 +31673,12 @@ function getTestCaseDetails(testCase) {
core.debug(`utpFilePath: ${utpFilePath}`);
const filePath = `${concatProjectPath}${utpFilePath}`;
core.debug(`filePath: ${filePath}`);
const regex = /(\.\/|\.\\)/;
const filePathWithSeparator = filePath.replace(regex, '');
const filePathWithSeparator = filePath.replace(/(\.\/|\.\\)/, '');
core.debug(`filePathWithSeparator: ${filePathWithSeparator}`);
core.error(utp.message, { file: filePathWithSeparator, startLine: utp.lineNumber });
}
return utp.message;
}).filter((line) => line !== undefined && line !== '');
});
const outputLines = testCase['output'].split('\n').map((line) => line.trim()).filter((line) => line !== '' && !line.match(/##utp:/));
if (outputLines.length > 0) {
details += '\n---\n';
details += `\`\`\`log\n${outputLines.join('\n')}\n\`\`\`\n`;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ function getTestCaseDetails(testCase: any): string {
}
details += `\`\`\`\n`;
}
const utps = parseUtp(testCase['output']);
const outputLines = utps.map((utp) => {
const utpOutput = parseUtp(testCase['output']);
utpOutput.map((utp) => {
core.debug(JSON.stringify(utp, null, 2));
// annotate failed test cases with the error message
if (utp.type === 'TestStatus' && utp.phase === 'End' && utp.state === 5) {
Expand All @@ -168,13 +168,12 @@ function getTestCaseDetails(testCase: any): string {
core.debug(`utpFilePath: ${utpFilePath}`);
const filePath = `${concatProjectPath}${utpFilePath}`;
core.debug(`filePath: ${filePath}`);
const regex = /(\.\/|\.\\)/;
const filePathWithSeparator = filePath.replace(regex, '');
const filePathWithSeparator = filePath.replace(/(\.\/|\.\\)/, '');
core.debug(`filePathWithSeparator: ${filePathWithSeparator}`);
core.error(utp.message, { file: filePathWithSeparator, startLine: utp.lineNumber });
}
return utp.message;
}).filter((line) => line !== undefined && line !== '');
});
const outputLines = testCase['output'].split('\n').map((line: string) => line.trim()).filter((line: string) => line !== '' && !line.match(/##utp:/));
if (outputLines.length > 0) {
details += '\n---\n';
details += `\`\`\`log\n${outputLines.join('\n')}\n\`\`\`\n`;
Expand Down

0 comments on commit 967ed0d

Please sign in to comment.