Skip to content

Commit 780422b

Browse files
State Pester migration checks and version conditions directly
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 64ffb1d commit 780422b

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

  • .github/plugin/psmodule/skills/psmodule-pester-migration

‎.github/plugin/psmodule/skills/psmodule-pester-migration/SKILL.md‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ Required compatibility work:
3434
blocks in the same scope.
3535
- Replace removed `Assert-MockCalled` and `Assert-VerifiableMock`.
3636
- Add a default mock when a parameter-filtered mock must handle other calls.
37-
- Review `<...>` name templates because their contents are now expressions.
37+
- Review `<...>` name templates because Pester v6 evaluates their contents as
38+
PowerShell expressions.
3839
- Replace `Set-ItResult -Pending` with `-Inconclusive`, `-Skipped`, or
3940
`It -Skip`.
4041
- Review coverage tracer and output format settings.
4142
- Replace removed v4-style `Invoke-Pester` parameters with
4243
`New-PesterConfiguration`.
4344
- Rename a real `None` tag; in v6 it is reserved for untagged tests.
4445

45-
Optional v6 adoption after compatibility is green:
46+
Optional v6 adoption after the required compatibility checks pass:
4647

4748
- Convert classic `Should -Be` assertions to `Should-Be` commands
4849
incrementally. Classic syntax remains supported.
@@ -84,7 +85,7 @@ For each test set, add an inventory row to the migration report:
8485
| Baseline | Run command, result counts, known failures |
8586

8687
Use the inventory to find test sets that are not reachable from the default
87-
workflow. A green workflow is not evidence that every test set was migrated.
88+
workflow. A workflow that passes is not evidence that every test set was migrated.
8889

8990
## Test-state and data contract
9091

@@ -146,7 +147,7 @@ Record fixture ownership and availability in the inventory:
146147
| Shared service | `tests/BeforeAll.ps1` | Before module-local matrix | Deterministic run-scoped name |
147148
| Cleanup state | `tests/AfterAll.ps1` | Always-run teardown | Same `TestData` and run identity |
148149

149-
Fail loudly when required data or state is absent. Do not use a broad
150+
If required data or state is absent, fail the test. Do not use a broad
150151
`try/catch`, an empty default, or an implicit import to turn a missing fixture
151152
into a passing or skipped test.
152153

@@ -168,16 +169,16 @@ For every consumer repository, trace and record these surfaces before editing:
168169
| `Invoke-ScriptAnalyzer` integration | Publishes `PSModuleLint-*` results alongside test results | Treat lint suites as required result artifacts, not Pester test files |
169170
| Repository linter | Checks repository/workflow/Markdown files independently of Pester | Include skill and documentation paths in the repository lint inventory |
170171

171-
The current Process-PSModule flow specifically downloads the built module and
172-
imports it before module-local tests, while `Test-PSModule` resolves source or
173-
module paths for framework suites. The framework's own importability and
174-
manifest tests may import/remove the module because import is their subject;
175-
ordinary consumer tests must not copy that pattern as setup.
172+
Process-PSModule downloads the built module and imports it before module-local
173+
tests. `Test-PSModule` resolves source or module paths for framework suites. The
174+
framework's own importability and manifest tests may import or remove the module
175+
because import is their subject. Ordinary consumer tests must not copy that
176+
pattern as setup.
176177

177178
Record the `PSModule/Invoke-Pester` action revision separately from the Pester
178-
module version. The current Process-PSModule workflows reference that action at
179-
`v5.1.0`; its revision and its Pester installation policy must both be checked
180-
when adopting Pester 6.1.0. Updating one does not prove that the other changed.
179+
module version. When adopting Pester 6.1.0, check both the action revision and its
180+
Pester installation policy. This includes workflows that reference `v5.1.0`.
181+
Updating one does not prove that the other changed.
181182

182183
Use this per-repository checklist:
183184

@@ -322,8 +323,8 @@ Should -Invoke Get-Thing -Times 1 -Exactly
322323
Should -InvokeVerifiable
323324
```
324325

325-
In v6, a call that matches no `-ParameterFilter` no longer falls through to
326-
the real command. Add an unfiltered default mock when other calls are valid:
326+
In v6, a call that matches no `-ParameterFilter` does not run the real command.
327+
Add an unfiltered default mock when other calls are valid:
327328

328329
```powershell
329330
Mock Get-Thing { 'default' }
@@ -348,8 +349,8 @@ should be reported for follow-up.
348349

349350
### Name templates
350351

351-
In v6, every `<...>` token in a `Describe`, `Context`, or `It` name is
352-
evaluated as a PowerShell expression in the test scope. Review arithmetic,
352+
In v6, Pester evaluates every `<...>` token in a `Describe`, `Context`, or `It`
353+
name as a PowerShell expression in the test scope. Review arithmetic,
353354
method calls, and expressions that were literal in v5. Escape a leading `<`
354355
when literal text is intended:
355356

@@ -368,15 +369,15 @@ filters and reports.
368369
### Coverage
369370

370371
Pester 6 uses the Profiler tracer by default and `CodeCoverage.UseBreakpoints`
371-
defaults to `$false`. Keep the new default unless compatibility with historical
372-
coverage numbers requires:
372+
defaults to `$false`. Keep this default. If compatibility with earlier coverage
373+
numbers requires breakpoints, use:
373374

374375
```powershell
375376
$config.CodeCoverage.UseBreakpoints = $true
376377
```
377378

378379
`CoverageGutters` is removed. Use `JaCoCo` or `Cobertura`; coverage paths are
379-
already relative to `Run.RepoRoot`.
380+
relative to `Run.RepoRoot`.
380381

381382
## Step 5: Standardize Invoke-Pester configuration
382383

@@ -403,7 +404,7 @@ Invoke-Pester -Configuration $config
403404

404405
Set `Run.ExcludePath` for intentional exclusions, and keep paths relative to
405406
the repository root where CI and local runs share the same layout. Do not
406-
disable failures globally to make a migration green.
407+
disable failures globally to make migration checks pass.
407408

408409
## Step 6: Optional v6 features
409410

@@ -430,7 +431,7 @@ $value | Should -Be 1 # compatible and may remain
430431
$value | Should-Be 1 # optional v6 style
431432
```
432433

433-
If converting, review behavior rather than applying a blind rename:
434+
If converting, review each assertion's behavior before changing its name:
434435

435436
- `Should -Not -Be` becomes `Should-NotBe`.
436437
- Truthy/falsy expectations may need `Should-BeTruthy` or `Should-BeFalsy`;

0 commit comments

Comments
 (0)