Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add input to truncate stack traces in annotations #1007

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

stackptr
Copy link
Contributor

Updates parsing of JUnit tests to conditionally truncate stack traces based on input to the action. Uses the first line of the message when logging the path, line, and test duration, in the same manner as annotateTestResult. Maintains default behavior to truncate if input is not used.

Provides a way forward for users encountering #1006

Updates parsing of JUnit tests to conditionally truncate stack traces based on input to the action. Uses the first line of the `message` when logging the path, line, and test duration, in the same manner as `annotateTestResult`. Maintains default behavior to truncate if input is not used.
@@ -375,7 +381,7 @@ async function parseSuite(
// fish the time-taken out of the test case attributes, if present
const testTime = testcase._attributes.time === undefined ? '' : ` (${testcase._attributes.time}s)`

core.info(`${resolvedPath}:${pos.line} | ${message.replace(/\n/g, ' ')}${testTime}`)
core.info(`${resolvedPath}:${pos.line} | ${message.split('\n', 1)[0]}${testTime}`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the event that message is a full stack trace, it seems more polite to just log the first line. This should be the only change that impacts existing users of the action.

@mikepenz
Copy link
Owner

Thank you very much for your contribution!

@mikepenz mikepenz merged commit 23a11fe into mikepenz:main Jan 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants