Give returning v5 users the assertion rename map - #468
Open
nohwnd wants to merge 1 commit into
Open
Conversation
The tutorial says Should-Be and Should -Be both work, which is true, and then uses Should-HaveType, Should-BeCollection, Should-BeNull and Should-BeLessThan without saying which v5 operator each one replaces. The names are not a mechanical translation, so guessing fails with a plain CommandNotFoundException and no suggestion. Add a table of the ones the tutorial uses plus the few that catch people out. Say why TestDrive asserts with Test-Path piped into Should-BeTrue. There is no Should-Exist in the new family, so it is a replacement rather than a preference. Say where Assert-MockCalled went, on the page that teaches Should-Invoke. Mark the mock fall-through change as the one most likely to turn an existing green v5 suite red, it was framed only as a nice property of a new suite. The migration guide documents the Assert-MockCalled symptom as "The term 'Assert-MockCalled' is not recognized", which is not what you get. The command is still in the manifest, so PowerShell tries to auto-load Pester and reports the load failure instead, and somebody searching for what they saw does not find the section. Fix #463
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.
Fix #463
Last of the stack, on top of #467. Review #464, #465, #466, #467 first.
The tutorial says
Should-BeandShould -Beboth work, which is true, I mixed them inside oneItand both passed. Then it usesShould-HaveType,Should-BeCollection,Should-BeNullandShould-BeLessThanwithout saying which v5 operator each one replaces. The names are not a mechanical translation of the old parameters, so guessing fails with a plainCommandNotFoundExceptionand no suggestion. I guessed eight and got eight of those.Added a table of the assertions the tutorial uses plus the few that catch people out, and a line saying the old operators are not deprecated so leaving a suite alone is a valid choice.
Three related things.
tutorial/5-working-with-files/2-testdrive.mdxusesTest-Pathpiped intoShould-BeTrueand reads like a style choice. There is noShould-Existin the new family, so it is the replacement, and now the page says that.tutorial/4-mocking/3-verifying-calls.mdxteachesShould-Invokefrom scratch and never says whereAssert-MockCalledwent. Same page framed the mock fall-through removal as a nice property of a new suite, when it is the change most likely to turn an existing green v5 suite red. Both now say so.docs/migrations/v5-to-v6.mdxdocuments theAssert-MockCalledsymptom as:That is not what you get. The command is still listed in the manifest, so PowerShell tries to auto-load Pester and reports the load failure instead:
Somebody searching for the message they actually saw does not find that section, which is the one job the Symptom block has.
Verification
Every row of the table is a passing test rather than something I remembered, each one asserting the v5 form and the v6 form against the same value:
That includes confirming
Should-Existdoes not exist. TheAssert-MockCalledmessage above is copied from a real 6.1.0 session. Site builds.🤖