/testing-automation:pester-should-migration File, folder, or test suite to migratefrom testing-automation
Converts classic Pester v5 `Should -...` assertions to Pester v6 `Should-*` commands using behavior-aware mappings. For migrating .Tests.ps1 files.
Ships in testing-automation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Convert classic space-separated Pester assertions such as Should -Be to the Pester v6 command form such as Should-Be, using behavior-aware mappings instead of blind text replacement.
Should -Be to Pester v6 style."Should -Not -Be calls in these .Tests.ps1 files."Should.DisableV5 after converting assertions."Use $ARGUMENTS as the file, folder, or suite scope to migrate. If $ARGUMENTS is empty, inspect the user's selected context or ask for a target before editing. Limit changes to PowerShell files, especially *.Tests.ps1 and relevant .ps1 helpers.
Should-* commands.Should -Be style still works in v6, so migration is optional and incremental.pester-migration skill when the suite also needs runtime, mock, or config migration across v3→v4→v5→v6.references/assertion-map.md: full operator-by-operator conversion table with before/after examples and workarounds.Load it for any operator not listed in the quick mapping or when a behavioral gotcha applies.
| Classic v5 | New v6 |
|---|---|
$x | Should -Be 1 | $x | Should-Be 1 |
$x | Should -Not -Be 1 | $x | Should-NotBe 1 |
$x | Should -BeExactly 'A' | $x | Should-BeString 'A' -CaseSensitive |
$x | Should -BeGreaterOrEqual 2 | $x | Should-BeGreaterThanOrEqual 2 |
$x | Should -BeLessOrEqual 2 | $x | Should-BeLessThanOrEqual 2 |
$x | Should -BeLike 'a*' | $x | Should-BeLikeString 'a*' |
$x | Should -Match 're' | $x | Should-MatchString 're' |
$x | Should -BeOfType [int] | $x | Should-HaveType ([int]) |
$x | Should -BeNullOrEmpty | Choose Should-BeNull, Should-BeEmptyString, Should-BeCollection -Count 0, or Should-BeFalsy. |
$c | Should -HaveCount 3 | $c | Should-BeCollection -Count 3 |
$c | Should -Contain 2 | $c | Should-ContainCollection 2 |
{ ... } | Should -Throw 'msg' | { ... } | Should-Throw -ExceptionMessage 'msg' |
Should -Invoke Get-Thing | Should-Invoke Get-Thing |
Should -InvokeVerifiable | Should-Invoke -Verifiable |
Assert-MockCalled | Should-Invoke when also completing broader v6 mock migration. |
Should -, Should -Not -, and Assert-MockCalled in *.Tests.ps1 and .ps1 files.Should -Exist, file-content assertions, and Should -BeIn.Invoke-Pester -Path ./tests or the smallest equivalent suite command.$config = New-PesterConfiguration
$config.Should.DisableV5 = $true
| Gotcha | Rule |
|---|---|
| Case sensitivity | Should -Be is case-insensitive; Should -BeExactly requires Should-BeString -CaseSensitive. Also map BeLikeExactly to Should-BeLikeString -CaseSensitive and MatchExactly to Should-MatchString -CaseSensitive. |
| Truthy/falsy | Classic Should -BeTrue and Should -BeFalse accept truthy/falsy values. New Should-BeTrue and Should-BeFalse are strict booleans; use Should-BeTruthy or Should-BeFalsy to preserve loose behavior. |
| Null or empty | BeNullOrEmpty has no single equivalent. Pick null, empty string, empty collection, whitespace, or falsy by test intent. |
| Collections | New Should-Be is a value assertion and errors when -Expected is a collection. Use Should-BeCollection for arrays and exact collection equality. |
| Pipeline unwrapping | Pipeline input unwraps @(1) to 1, @() to $null, and re-collects typed arrays as [object[]]. Use -Actual when exact value or concrete type matters. |
| Missing equivalents | Should -Exist and Should -FileContentMatch* have no new counterpart. Keep classic form or rewrite with Test-Path and Get-Content -Raw. |
| BeIn direction | There is no Should-BeIn; reverse operands with Should-ContainCollection or keep the classic form. |
Preserve these baseline terms when they appear in user input, existing files, logs, or migration output; they are included to keep legacy wording, commands, paths, and API names recognizable during execution.
->andas$collection | Should-ContainCollection $value$false$null$true$value | Should -BeIn $collection$x | Should-Be 1(Get-Content $p -Raw) | Should-MatchString 're'). The new *.ps1, and a typed collection (-Actual-BeFalse-Because-Not1, 2, 3 | Should-ContainCollection @(1, 2)ShouldShould -*Should -ContainShould -Not -BeNullOrEmptyShould-Be -Actual $x -Expected 1Should-HaveTypeShould-NotBeShould-NotBeEmptyStringShould-NotBeNullShould-NotBeWhiteSpaceStringTest-Path $p | Should-BeTrue[object[]]actual/expectedcase-sensitivehttps://pester.dev/docs/assertions/should-commandhttps://pester.dev/docs/commands/Should-Behttps://pester.dev/docs/migrations/v5-to-v6re-checkre-collectedsingle-itemstep-3--check-the-behavioral-gotchas-do-not-skiptype-awarewhole-collection## Pester Should migration result
**Status:** complete | needs human decision | blocked
**Scope:** `$ARGUMENTS`
### Assertion changes
| File | Converted | Left classic | Reason |
| --- | ---: | ---: | --- |
| `<file>.Tests.ps1` | <count> | <count> | <Should -Exist, BeNullOrEmpty decision, or none> |
### Validation
- `Invoke-Pester -Path ./tests`: <pass/fail/not run>
### Human decisions
- <truthy/falsy, null-or-empty, collection, or direction choice>
$ARGUMENTS or selected scope was consumed and limited to PowerShell test targets.references/assertion-map.md was used for non-trivial operators.Should -Exist and Should -FileContentMatch* were kept or rewritten intentionally.Invoke-Pester or the suite's existing test command was run after changes.Should.DisableV5 enforcement happened only after remaining classic assertions were addressed.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin testing-automation13 skills in this plugin
/ai-prompt-engineering-safety-reviewReview and improve AI prompts for safety, bias, security, privacy, effectiveness, robustness, and testability. Use this skill when the user asks to audit a prompt, harden a system prompt, identify prompt injection risk, reduce bias, improve guardrails, or produce a safer enhanced prompt./csharp-nunitDesign, write, and review NUnit tests for .NET projects, including standard tests, data-driven tests, assertions, setup/teardown, categories, and isolation with mocks. Use this skill when the user asks for NUnit best practices, `dotnet test`, `[TestCase]`, `[TestCaseSource]`, or C# unit test structure./Other plugins' skills for the same job