Skip to content

improvement: Add stack trace to failed results #837

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

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

tgodzik
Copy link
Collaborator

@tgodzik tgodzik commented Jan 24, 2025

We can later check the first line using existing mechanisms in Metals to get the location

Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

I hope it's not too verbose when there are a lot of failing tests. But otherwise it looks good to me.

@tgodzik tgodzik marked this pull request as ready for review February 5, 2025 16:55
@tgodzik
Copy link
Collaborator Author

tgodzik commented Feb 5, 2025

We could add both location and stack trace, so that Metals can fill location based on the stack trace, should be a very simple matter of intercepting the message in https://github.com/scalameta/metals/blob/main/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProxy.scala#L275

val formatted =
TestSuiteEventHandler.formatError(
name,
failedMsg,
indentSize = 0
)
SingleTestResult.Failed(name, e.duration, formatted)
SingleTestResult.Failed(name, e.duration, formatted, stackTrace, location = null)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I realized it's gson, so this needs to be null instead of Option

@tgodzik
Copy link
Collaborator Author

tgodzik commented Feb 5, 2025

I also added the location, so that it's just a case of updating it in Metals

@tgodzik tgodzik requested a review from adpi2 February 5, 2025 17:43
@tgodzik tgodzik merged commit 25efb91 into scalacenter:main Feb 6, 2025
9 checks passed
@tgodzik tgodzik deleted the add-stacktrace branch February 6, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants