Skip to content

Remove code specifically for PS 2.0-5.0#2735

Open
nohwnd wants to merge 1 commit into
mainfrom
fix/2510-remove-ps2-5-compat
Open

Remove code specifically for PS 2.0-5.0#2735
nohwnd wants to merge 1 commit into
mainfrom
fix/2510-remove-ps2-5-compat

Conversation

@nohwnd

@nohwnd nohwnd commented Jun 18, 2026

Copy link
Copy Markdown
Member

Remove version guards that are always true on PS 5.1+ (-ge 3, -ge 4, -ge 5) and their dead else branches. Tighten -ge 6\ to -ge 7\ since PS 6.x is EOL and Pester 6 supports PS 5.1 and PS 7+ only.

Changes across 6 files, removing ~80 lines of dead code:

  • Coverage.ps1: remove guards around DSC, class AST, and base constructor checks; remove pre-PS5 DSC keyword detection path
  • Mock.ps1: remove guards around PositionalBinding, parameter validation, alias repair; remove pre-PS5 \EscapeSingleQuotedStringContent\ fallback; remove pre-5.0.10586 reflection path for dynamic parameters
  • Output.ps1: simplify \HostSupportsOutput\ to always true
  • Pester.Types.ps1, TestDrive.ps1, Environment.ps1: -ge 6\ to -ge 7\

Fixes #2510

Remove version guards that are always true on PS 5.1+ (-ge 3, -ge 4,
-ge 5) and their dead else branches. This includes:

- Coverage.ps1: remove -ge 4/-ge 5 guards around DSC, class AST, and
  base constructor checks; remove pre-PS5 DSC keyword detection path
- Mock.ps1: remove -ge 3 guards around PositionalBinding, parameter
  validation, and alias repair; remove -ge 5 guard and pre-PS5 fallback
  in EscapeSingleQuotedStringContent; remove pre-5.0.10586 reflection
  path for dynamic parameters
- Output.ps1: simplify HostSupportsOutput to always true (PS 5+ uses
  InformationRecords)
- Pester.Types.ps1, TestDrive.ps1, Environment.ps1: tighten -ge 6 to
  -ge 7 (PS 6.x is EOL, Pester 6 supports PS 5.1 and PS 7+)

Fixes #2510

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove code specifically for PS 2.0-5.0

1 participant