Improve comment-based help examples for new Should-* assertions#2768
Open
nohwnd wants to merge 1 commit into
Open
Improve comment-based help examples for new Should-* assertions#2768nohwnd wants to merge 1 commit into
nohwnd wants to merge 1 commit into
Conversation
The command-reference pages on pester.dev are generated from this
comment-based help. The examples for the six newer assertions had
several problems, which this fixes:
- Should-Invoke / Should-NotInvoke: replace the {... Some Code ...}
placeholders and the un-fenced examples (which render as escaped text)
with real, runnable examples. Fix the Should-NotInvoke explanations,
which were copied from Should-Invoke and described the opposite
behavior (e.g. 'throws if ... is not called').
- Should-HaveParameter / Should-NotHaveParameter: use the new
Should-HaveParameter syntax instead of the old 'Should -HaveParameter';
add -Type/-DefaultValue/-Alias/-InParameterSet examples; make the
Should-NotHaveParameter example pass; drop the irrelevant
ArgumentCompleter note.
- Should-MatchString / Should-NotMatchString: replace the abstract
hello/h.*o samples with real-life regex checks.
All examples were validated against Pester 6.0.0. Comment-only change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Improves the
.EXAMPLEblocks (and a couple of explanations) in the comment-based help for the six newer v6 assertions:Should-Invoke/Should-NotInvokeShould-HaveParameter/Should-NotHaveParameterShould-MatchString/Should-NotMatchStringWhy
The command-reference pages on pester.dev are generated from this comment-based help, and the examples for these commands had several issues:
Should-Invoke/Should-NotInvoke— carried over{... Some Code ...}placeholders from the legacyAssert-MockCalledhelp, and several examples were missing code fences so they render as escaped text on the site. TheShould-NotInvokeexplanations were copy-pasted fromShould-Invokeand described the opposite behavior (e.g. "throws if ... is not called").Should-HaveParameter/Should-NotHaveParameter— used the oldShould -HaveParameter(space) syntax instead of the newShould-HaveParameter;Should-HaveParameterhad only one example (no-Type/-DefaultValue/-Alias/-InParameterSet); theShould-NotHaveParameterexample showed a failing test and carried an irrelevant-HasArgumentCompleternote.Should-MatchString/Should-NotMatchString— only abstracthello/h.*osamples; replaced with real-life regex checks (GUID, version, secret-leak guard, etc.).Notes
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com