Skip to content

Pin or migrate test suite for Pester version compatibility; add Windows CI #4

Description

@ekalb81

Problem

tests/Windows-Path-Repair-Full.Tests.ps1 uses Pester v3/v4 assertion syntax (Should Be, Should Not Throw). Under Pester 5 (the current default on modern systems) these fail with syntax errors, so the suite silently can't run for many contributors. There is also no CI, so regressions on either Windows PowerShell 5.1 or PowerShell 7 go unnoticed.

A related review finding: the suite only exercises injected seams, never real persistent behavior — actual SetEnvironmentVariable/registry read-back, backup creation on apply, restore application, scope selection (-UserPathOnly/-SystemPathOnly), non-elevated Machine preflight, and launcher quoting are all uncovered. Tests must still never modify the runner's real persistent PATH, so cover these via preview-mode runs, seams, and (where safe on a disposable CI runner) a dedicated scratch environment variable rather than Path itself.

Proposed fix

  • Migrate assertions to Pester 5 syntax (Should -Be, Should -Not -Throw), or pin Pester 4 explicitly in a test bootstrap — migration preferred.
  • Add a GitHub Actions workflow on windows-latest running the suite under both powershell (5.1) and pwsh (7).
  • Add cases for: non-elevated Machine-scope preflight, scope selection previews, backup-file creation/restore preview flow, and launcher argument quoting (see Harden Run-PATH-Repair-Admin.bat argument quoting for unusual repository paths #5).
  • Ensure tests never modify the runner's real persistent PATH values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions