Repository navigation
Feature Request: ShouldResult property - #2381
Conversation
fflaten
left a comment
There was a problem hiding this comment.
Thanks again for looking into this 👏
Can't test and fully review for a few days, but added some initial thoughts.
| return [Pester.ShouldResult] @{ | ||
| Succeeded = $succeeded | ||
| FailureMessage = $failureMessage | ||
| ExpectResult = @{ |
There was a problem hiding this comment.
Here it populates the values no matter if the should fails, in some other places it only populates them when should fails. What is the desired way?
There was a problem hiding this comment.
Defer to @fflaten but seems to me it makes sense to not populate it if it's successful for minor performance benefit, the only use that info would be is troubleshooting (e.g. it said successful but it shouldn't have been)
There was a problem hiding this comment.
Wouldn't be exposed on success atm. so should avoid unnecessary cost imo 🙂
There was a problem hiding this comment.
All assertions should now be adjusted to not include this property on a success. Maybe we need tests for this?
|
Thanks for the PR, I am slightly worried about degrading perf by re-formatting the data where we don't need to, because the number of interactive runs where the functionality will be used is way smaller than the total of runs where this won't be used, and everyone will pay the price. Maybe conditioning it based on option, or env var, or both is the best way forward here. Some options (like CI output) already use this pattern. And then taking care to not reformat the same data in the assertions. |
Co-authored-by: Frode Flaten <[email protected]>
|
@fflaten @nohwnd The strong typing already showed me that Given this, to avoid some more potential regressions I propose that the builtin assertions I have modified will continue to emit the strong typed |
Right. Not aware of the history there. I've been considering a PR to move those,
Sounds like a bug and another benefit of strongly typing 🙂 It should've been typed already as the output requirements are documented and cast works. There's no way to access additional properties through However, I guess there's a slight chance someone leverages the loose mapping to include something for ex. unit-testing |
|
I dropped the |
|
I've run it bunch of times, it does not seem to impact the speed negatively. Okay to merge imho. @fflaten wanna have one last look? |
|
@nohwnd thank you! |
|
Thank you both :) |
Fixes #1993
PR Summary
PR Checklist
Create Pull Requestto mark it as a draft. PR can be markedReady for reviewwhen it's ready.