/testing-frameworks:pester-migrationfrom testing-frameworks
Upgrades PowerShell Pester test suites across major versions (v3→v4, v4→v5, v5→v6) while preserving test intent. Handles syntax migration, Discovery/Run failures, mock scoping, and PesterConfiguration adoption.
Ships in testing-frameworks. 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.
Upgrade existing PowerShell Pester suites one major version at a time, using the correct migration guide for the source and target version, then rerun tests until the suite is green without changing what the tests assert.
*.Tests.ps1 and use Describe, Context, It, and Should.-SkipPublisherCheck.Load the reference for the exact jump before editing.
| Reference | When to load |
|---|---|
references/v3-to-v4.md | Should Be → Should -Be, Contain → FileContentMatch, Assert-VerifiableMocks → Assert-VerifiableMock, and array assertion edge cases. |
references/v4-to-v5.md | Discovery/Run split, BeforeAll, $PSScriptRoot, BeforeDiscovery, -ForEach, mock scoping, Should -Throw wildcards, and Invoke-Pester → New-PesterConfiguration. |
references/v5-to-v6.md | PowerShell 5.1/7.4+, per-file discovery+run, empty -ForEach, duplicate setup blocks, name <...> templates, Assert-MockCalled removal, mocks no longer fall through, code-coverage tracer, and legacy Invoke-Pester params removal. |
Canonical migration source: https://pester.dev/docs/migrations/v4-to-v5.
Run these before editing:
Get-Module Pester -ListAvailable | Select-Object Name, Version, Path
(Get-Module Pester).Version
Infer the suite's source version from code, not only the installed module.
| You see in tests or build scripts | Interpret as |
|---|---|
Should Be, Should Contain without a dash | v3 or earlier; start with references/v3-to-v4.md. |
$MyInvocation.MyCommand.Path and dot-sourcing at top level under Describe | v4; read references/v4-to-v5.md. |
Assert-MockCalled, Assert-VerifiableMock, Set-ItResult -Pending | v4 or early v5; these are removed in v6. |
Invoke-Pester -Script ... -OutputFile ... -CodeCoverage ... | Legacy invocation; map to config. |
BeforeAll { . $PSScriptRoot/... }, New-PesterConfiguration, Should -Invoke | Already v5-style; assess v5→v6. |
Install target versions deliberately:
Install-Module Pester -MaximumVersion 5.99.99 -Force
Install-Module Pester -Force
Remove-Module Pester; Import-Module Pester
Invoke-Pester on the current version and record pass/fail so migration regressions are distinguishable from pre-existing failures.Invoke-Pester -Output Detailed; for hard v4→v5 failures use -Output Diagnostic and match symptoms to the reference tables.git bisect remains useful.| Jump | Difficulty | Nature | Key work |
|---|---|---|---|
| v3 → v4 | Low | Assertion syntax rename. | Should -Be, FileContentMatch, Assert-VerifiableMock, array assertion review. |
| v4 → v5 | High | Fundamental runtime change. | Move setup into BeforeAll; discovery-time generation into BeforeDiscovery; use $PSScriptRoot; migrate Invoke-Pester to config. |
| v5 → v6 | Low–Medium | Deprecated features now throw. | Replace removed mock verbs, handle empty -ForEach, merge duplicate setup blocks, account for no mock fall-through. |
# BEFORE
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\Get-Thing.ps1"
# AFTER
BeforeAll { . $PSScriptRoot/Get-Thing.ps1 }
BeforeDiscovery { $cases = Get-Content $PSScriptRoot/cases.json | ConvertFrom-Json }
{ throw 'a long message' } | Should -Throw '*long*'
Should -Invoke Get-Thing -Times 1 -Exactly
Should -InvokeVerifiable
Mock Get-Thing { 'default' }
Mock Get-Thing -ParameterFilter { $Name -eq 'a' } -MockWith { 'a' }
Describe 'Optional' -ForEach $cases -AllowNullOrEmptyForEach { }
Should and dot-sourcing replacements but produce false positives.*.Tests.ps1.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.
-Output DetailedBeforeAll { . $PSScriptRoot/… }BeforeAll/BeforeEach/AfterAll/AfterEachDISCOVERSDISCOVERS/generatesForEach/-TestCasesInstall-ModuleInvoke-Pester -Script … -OutputFile … -CodeCoverage …Path/-OutputScript/-OutputFilearray-assertionbackwards-compatiblebreaking-changedata-drivendifferently-signeddot-sourceearly-v5file/concern.**find-replaceknown-goodpass/fail.passing/failingper-jumppreviously-deprecatedre-importre-runscript-automatablesymptom-driventwo-phasev3/v4PowerShellGet note: on Windows PowerShell 5.1, PowerShellGet may require -SkipPublisherCheck for side-by-side Pester installation.
## Pester migration result
**Status:** complete | needs fixes | blocked
**Source version:** <v3|v4|v5|unknown>
**Target version:** <v4|v5|v6>
### Files changed
| File | Migration applied | Validation |
| --- | --- | --- |
| `*.Tests.ps1` | <syntax/setup/mock/config change> | <pass/fail evidence> |
### Commands run
- `Get-Module Pester -ListAvailable | Select-Object Name, Version, Path`
- `Invoke-Pester <options>`
### Remaining issues
- <failure, symptom, or human decision>
references/ guide was loaded before edits.Invoke-Pester results were recorded.BeforeAll, BeforeDiscovery, $PSScriptRoot, mocks, -ForEach, and New-PesterConfiguration were handled when applicable.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-frameworks6 skills in this plugin
/javascript-typescript-jestWrite and review JavaScript and TypeScript Jest tests with strong structure, mocks, async handling, snapshots, and React Testing Library patterns. Use this skill when the user asks to add Jest tests, improve test structure, mock APIs or databases, test async code, update snapshots, or test React components./pester-should-migrationConvert classic Pester v5 `Should -...` assertions to Pester v6 `Should-*` assertion commands while preserving behavior. Use when asked to migrate, convert, rewrite, or modernize `Should -Be`, `Should -Not -Be`, `Should -Throw`, `Should -Invoke`, or other assertions in .Tests.ps1 and PowerShell files./pytest-coverageRun pytest with coverage, read annotated coverage output, identify uncovered lines, and add tests until Python code reaches 100% line coverage. Use this skill when the user asks to run pytest coverage, inspect cov_annotate files, cover missing lines, target a module with --cov, or improve test coverage to 100%./scoutqa-testThis skill should be used when the user asks to "test this website", "run exploratory testing", "check for accessibility issues", "verify the login flow works", "find bugs on this page", or requests automated QA testing. Triggers on web application testing scenarios including smoke tests, accessibility audits, e-commerce flows, and user flow validation using ScoutQA CLI. Use this skill proactively after implementing web application features to verify they work correctly./unit-test-vue-piniaWrite and review unit tests for Vue 3 + TypeScript + Vitest + Pinia codebases. Use when creating or updating tests for components, composables, and stores; mocking Pinia with createTestingPinia; applying Vue Test Utils patterns; and enforcing black-box assertions over implementation details.Other plugins' skills for the same job