Skip to content

Migrate PowerShell tests to Pester 6#2204

Open
MSBrett wants to merge 1 commit into
MSBrett/revert-pr2163-full-rollbackfrom
MSBrett/pester-6-migration
Open

Migrate PowerShell tests to Pester 6#2204
MSBrett wants to merge 1 commit into
MSBrett/revert-pr2163-full-rollbackfrom
MSBrett/pester-6-migration

Conversation

@MSBrett

@MSBrett MSBrett commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the PowerShell test suite to Pester 6 after PR #2203 restores the reviewed PR #2163 tree and pins CI back to Pester 5.7.1.

This PR intentionally makes the Pester 6 move explicit instead of relying on unreviewed compatibility shims or post-approval test edits.

Requirements traceability matrix

Requirement Implementation Verification
Update CI to Pester 6 Changed the PR validation workflow module cache from Pester 5.7.1 to Pester 6.0.0. Ran lint and unit tests under Pester 6.0.0.
Remove legacy mock assertions Migrated remaining Assert-MockCalled usage in PowerShell tests to Should -Invoke. Confirmed no Assert-MockCalled remains under src/powershell/Tests.
Avoid compatibility shims Did not add global Pester imports, Assert-MockCalled wrappers, or shared test-suite shims. Confirmed no Pester global import or Assert-MockCalled shim remains under src/powershell/Tests.
Handle Pester 6 discovery behavior Added explicit empty data handling for data-driven docs link tests and moved New-Directory setup to BeforeDiscovery. Pester 6 discovery and execution completed successfully for lint/unit CI.
Validate touched integration assertion Ran the integration test path under Pester 6.0.0. The changed mocked long-running CostExports test passed: Should wait 60s when throttled.

Validation

  • GitHub Actions Pester 6.0.0 lint: Tests Passed: 2982, Failed: 0
  • GitHub Actions Pester 6.0.0 unit: Tests Passed: 1892, Failed: 0, Skipped: 4
  • Local Pester 6.0.0 integration run attempted via Start-PesterTest -Type Integration
    • Changed integration assertion passed: Context Long-running unit tests / Should wait 60s when throttled
    • Full integration suite did not pass in this local Azure context due broader integration-suite issues:
      • CostExports live create/update tests failed because the generated storage account has key-based authentication disabled (BadRequest)
      • Hubs.Tests.ps1 failed discovery because Get-FinOpsHubRequiredResourceProvider is not visible from Pester 6 BeforeDiscovery
      • Workbook Resource Graph query execution/performance checks failed/inconclusive with BadRequest
    • Test resource group ftk-integration-tests was left with 0 resources after the run

Stacked on #2203 so this review only covers the explicit Pester 6 migration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@MSBrett MSBrett requested a review from flanakin as a code owner July 7, 2026 19:50
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs: Review 👀 PR that is ready to be reviewed label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Review 👀 PR that is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant