-
-
Notifications
You must be signed in to change notification settings - Fork 473
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
Feature Request: ShouldResult property #2381
Conversation
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.
Thanks again for looking into this 👏
Can't test and fully review for a few days, but added some initial thoughts.
Succeeded = $succeeded | ||
FailureMessage = $failureMessage | ||
ExpectResult = @{ |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be exposed on success atm. so should avoid unnecessary cost imo 🙂
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.
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 <3436158+fflaten@users.noreply.github.com>
@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 Request
to mark it as a draft. PR can be markedReady for review
when it's ready.