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
Limit output information for failed tests #1975
Conversation
Hi @nohwnd and @fflaten. Ready to have this reviewed, will need to have some feedback to see if I'm on the right track here 😃. Also for some reason the PS6_2 build is failing with this error:
I am not sure what the issue is here from the error log. I'm thinking of running a docker container with that PS version to see what is wrong. Seemed to start happening when I added my own tests to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, it is probably tested anyway, but it would be nice to have explicit test for the display tack trace property having value even if the ShowStackTrace is set to false.
I would also like to see the first line of the stack trace, as we discussed in the issue. But I am sure others will prefer this bare output in some cases so we might need to make it an enum.
Yeah that test is flaky. If that is the only thing that fails I will re-run it or ignore it. I need to fix that test, or remove it. |
5017977
to
dd70e8b
Compare
Thanks for the review @nohwnd, I will add another test for that case. I can also change the above to using an enum. Would you be ok with the following verbosity settings:
I could create a |
I will have to think about the names, but knee-jerk they would be:
The default for us is to filter-out lines that belong to Pester. @fflaten looks good? |
I agree. Thinking Simple/FirstLine for the short one. Add a deprecation notice to Debug.ShowFullError as I guess Full might be a replacement? |
Yeah we can just deprecate it, and make it override the new option to Full. |
I may also be doing the Filtered option incorrectly. Will need to review the behavior from https://github.com/pester/Pester/blob/main/src/functions/Output.ps1#L423 to see If I need to change this, since currently I am just outputting the lines from the trace that are picked up as Pester internal functions. I guess I might need some help defining pester specific lines that need to be filtered, since my current Filtered option seems to be leaving a lot out, and some lines from the Full output look like they should belong in Filtered. |
@nohwnd I've updated this PR to use a new option for those various levels of output. Also added some images in the description to show new behavior + some review comments with things I'm not sure need to be changed. Let me know what you think 🙂 |
I've read it yesterday, thanks for the poke, comments above. |
Thanks for the feedback @nohwnd, really helpful. This looks pretty much done from a code perspective, let me know if there is anything I'm missing or need to address. |
Perfect. Merged. |
This is awesome, thanks everyone! |
PR Summary
Fix #917
I've added a
Output.StackTraceVerbosity
option with the following levels:None - All Stack trace is hidden
FirstLine - First line of stack trace is shown
Filtered - Filtered lines that belong to Pester. This is default.
Full - All stack trace is shown
Sample test
Sample setup code
None
FirstLine
Filtered(default)
Full
I've also include a simple deprecation notice to
Debug.ShowFullErrors
, which will overrideOutput.StackTraceVerbosity
toFull
.PR Checklist
Create Pull Request
to mark it as a draft. PR can be markedReady for review
when it's ready.