Skip to content

Give returning v5 users the assertion rename map - #468

Open
nohwnd wants to merge 1 commit into
nohwnd-tutorial-ci-exit-codefrom
nohwnd-tutorial-v5-rename-map
Open

Give returning v5 users the assertion rename map#468
nohwnd wants to merge 1 commit into
nohwnd-tutorial-ci-exit-codefrom
nohwnd-tutorial-v5-rename-map

Conversation

@nohwnd

@nohwnd nohwnd commented Aug 29, 2026

Copy link
Copy Markdown
Member

Fix #463

Last of the stack, on top of #467. Review #464, #465, #466, #467 first.

The tutorial says Should-Be and Should -Be both work, which is true, I mixed them inside one It and both passed. Then it 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 of the old parameters, so guessing fails with a plain CommandNotFoundException and 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.mdx uses Test-Path piped into Should-BeTrue and reads like a style choice. There is no Should-Exist in the new family, so it is the replacement, and now the page says that.

tutorial/4-mocking/3-verifying-calls.mdx teaches Should-Invoke from scratch and never says where Assert-MockCalled went. 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.mdx documents the Assert-MockCalled symptom as:

The term 'Assert-MockCalled' is not recognized as a name of a cmdlet, function, script file, or operable program.

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:

The 'Assert-MockCalled' command was found in the module 'Pester', but the module could not be
loaded due to the following error: [Should operator 'Be' is not registered]

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:

Describing v5 to v6 assertion mapping
Tests Passed: 8, Failed: 0, Skipped: 0, Inconclusive: 0, NotRun: 0

That includes confirming Should-Exist does not exist. The Assert-MockCalled message above is copied from a real 6.1.0 session. Site builds.

🤖

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant