pester-should-migration
Has your agent migrate Pester test syntax. It converts old commands to the new format, making test updates easier.
What it does
This tool helps update your code tests written in a language called Pester. It transforms the old way of writing tests (`Should -Be`) to the new way (`Should-Be`), making error messages clearer.
When to use it
- ✓When you want to modernize your tests to the latest Pester version.
- ✓When you need to convert old tests to the new format.
- ✓When you want more detailed and precise error messages.
Example of what to ask your AI
“Convert `Should -Be` tests to `Should-Be` in my code.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool looks for old patterns like `Should -Be` or `Should -Not -Be` and replaces them with the new `Should-Be` or `Should-NotBe`. Some conversions require extra attention to ensure the test behavior remains the same.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add github/awesome-copilot --skill pester-should-migrationOr download just the file:
curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/pester-should-migration/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Pester Should -* → Should-* Migration
Convert classic Pester v5 assertions (Should -Be, space then parameter) to the
new Pester v6 Should-* assertions (Should-Be, hyphen, no space).
Status: experimental / preview. Verified against Pester 6.0.0-rc2. The classic
Should -Bestyle still works in v6, so migrate incrementally and keep the suite green.
Companion skill. This skill covers the optional move to the new
Should-*operators. To upgrade a suite across major Pester versions (v3→v4→v5→v6 — the runtime, mocks, and config), use the separate pester-migration skill. In v6 the classicShould -Bekeeps working, so adoptingShould-*is independent of any version bump.
When to Use
- Modernizing a Pester suite to the v6
Should-*assertions. - A user asks to migrate / convert / rewrite
Should -...calls. - You want clearer, type-aware failure messages from the new assertions.
Know This First
- Both syntaxes work side by side in Pester v6. Migration is optional and can be done one test (or one file) at a time. Nothing breaks if you leave some classic.
- Requires Pester v6+. The
Should-*commands do not exist in v5. - Negation is a separate command, not a
-Notswitch:Should -Not -Be→Should-NotBe. There is no-Notparameter on the new assertions. - The actual value still comes from the pipeline (
$x | Should-Be 1) or from-Actual(Should-Be -Actual $x -Expected 1).-Becausecarries over unchanged. - Most renames are mechanical, but several have behavior changes you must check by hand — see Gotchas.
Procedure
Step 1 — Find the classic assertions
Search the target for the classic space-separated syntax (the tell is Should -,
or Should followed by -Not):
Should - # any classic operator
Should -Not - # negated classic operator
Assert-MockCalled # also removed in v6 -> Should-Invoke
Limit the scope to PowerShell test files (*.Tests.ps1, *.ps1).
Step 2 — Apply the mapping
Most-used conversions (full list in references/assertion-map.md):
| 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 |
depends — see gotchas (no single equivalent) |
$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 |
Step 3 — Check the behavioral gotchas (do NOT skip)
These do not translate by a plain rename. Read each before converting:
- Case sensitivity. Classic
Should -Beis case-insensitive on strings; so isShould-Be. But classicShould -BeExactly(case-sensitive) has no plain equivalent — useShould-BeString -CaseSensitive. (Should-Beis never case-sensitive.) Same pattern forBeLikeExactly→Should-BeLikeString -CaseSensitiveandMatchExactly→Should-MatchString -CaseSensitive. - Truthy vs. true. Classic
Should -BeTrue/-BeFalseaccept any truthy / falsy value (1,'x',0,'',$null,@()). The newShould-BeTrue/Should-BeFalseare strict (exactly$true/$false). To preserve the old loose behavior useShould-BeTruthy/Should-BeFalsy. Only use the strict ones when the value really is a boolean. BeNullOrEmptyhas no single equivalent. Pick by intent:$null→Should-BeNull; empty string →Should-BeEmptyString; empty collection →Should-BeCollection -Count 0; broad "falsy" →Should-BeFalsy. The negationShould -Not -BeNullOrEmptysimilarly splits intoShould-NotBeNull/Should-NotBeEmptyString/Should-NotBeWhiteSpaceString.
…
FAQ
Do I need to update all my tests at once?
No, you can update one test or one file at a time. Pester still understands the old format in the new version, so there's no rush.
What happens if I don't update?
Nothing will break immediately. Old tests will continue to work in Pester version 6. Updating is optional to take advantage of new features.
Can some tests stop working after updating?
Yes, some conversions are more complex (like `Should -BeNullOrEmpty` or collection comparisons) and may require manual adjustments to ensure the test behaves as expected. It's important to check tests after conversion.
Details
Original description by the author
Experimental (preview) Pester skill for migrating classic Should -Be (v5) assertion syntax to the new Should-* (v6) assertions (note the hyphen, no space), e.g. `Should -Be` -> `Should-Be`, `Should -Not -Be` -> `Should-NotBe`. Tracks Pester 6, which is still a release candidate, so this guidance may change; verified against Pester 6.0.0-rc2. Use when converting Pester v5 assertions to Pester v6 Sh
repo: github/awesome-copilot
Popularity
- GitHub stars
- 40k
- Ranking position
- #5262
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
acquire-codebase-knowledge
Helps your agent understand and document an existing code project. It's useful for onboarding new people or getting an overview of the architecture.
github/awesome-copilot
acreadiness-assess
Enables your agent to assess a project's readiness for AI and generate a report. It's useful for understanding how well a project is prepared to use AI tools.
github/awesome-copilot
acreadiness-generate-instructions
Helps your agent create instructions for AI tools based on an assessment. It's useful for improving how AI interacts with code and closing identified gaps.
github/awesome-copilot
acreadiness-policy
Enables your agent to help define or apply policies for AI project assessment. It's useful for standardizing how projects are evaluated and ensuring compliance.
github/awesome-copilot
Similar skills
cpp-testing
Makes your agent write and improve tests for C++ code. It helps set up testing tools and fix errors.
affaan-m/ECC
csharp-testing
Helps your agent create tests for C# and .NET code. It uses best practices to ensure tests are efficient and reliable.
affaan-m/ECC
django-tdd
Enables your agent to apply testing strategies for Django with pytest-django and TDD. It's useful for writing robust tests and ensuring code quality, especially for DRF APIs.
affaan-m/ECC