Skip to content

Phase 2: PS7-only modernization & CI - #2

Merged
exactmike merged 2 commits into
masterfrom
phase2/ps7-modernization-ci
Aug 29, 2026
Merged

Phase 2: PS7-only modernization & CI#2
exactmike merged 2 commits into
masterfrom
phase2/ps7-modernization-ci

Conversation

@exactmike

Copy link
Copy Markdown
Collaborator

Summary

  • Pin PowerShellVersion = '7.0' in PSGraph.psd1.
  • Migrate Tests/ off legacy Pester 3/4 Should X syntax to Pester 5 Should -X (including several lowercase-verb / typo'd forms a naive rename would've missed).
  • Fix a real Pester 5 migration bug, not just a syntax one: several test files computed shared fixture data directly in Describe/Context bodies ($dot = graph g {...}, $functions = Get-Command ...). Under Pester 5's discovery/run split that data is discovery-only and is $null by the time the It blocks actually execute — so these tests were never really exercising anything, on any CI that ever ran them. Fixed with BeforeAll (Export-PSGraph.Tests.ps1, Show-PSGraph.Tests.ps1) and Pester 5's -ForEach data binding (Tests/Project.Tests.ps1, Tests/Project/Help.Tests.ps1, Tests/Project/Module.Tests.ps1 — the last simplified from one-It-per-ScriptAnalyzer-violation to one aggregate It per script).
  • That fix surfaced two real, previously-never-run ScriptAnalyzer findings: Entity.ps1 clobbered the automatic $matches variable and lacks a process block (suppressed with a justification comment — it converts one InputObject into one Record by design, not a batch cmdlet), and Node.ps1 trips PSAvoidOverwritingBuiltInCmdlets (suppressed like the file's existing suppression — renaming the DSL keyword is out of scope here).
  • Pin Pester to 5.7.1 in build.ps1 and add -AllowClobber to the module installs (this dev machine had Pester 4.10.1 and 5.7.1 side by side, and a pre-existing Metadata module clash blocked BuildHelpers from installing without it).
  • Modernize BuildTasks/Pester.Task.ps1 off Pester 5's deprecated legacy simple-parameter Invoke-Pester call to New-PesterConfiguration.
  • Add .github/workflows/ci.yml: ubuntu/windows/macos × pwsh matrix. Installs Graphviz on every runner and runs the entire Tests/ suite untagged (not the -Tag Build filter Pester.Task.ps1 uses for the fast local dev loop) — this closes a real gap where the graphviz-tagged Export-PSGraph/Show-PSGraph tests, plus the untagged Edge/Row tests, never actually ran under the old -Tag Build-filtered pipeline.
  • Remove psake.ps1 (confirmed dead: absent from build.ps1's module list and unreferenced by either CI config) and appveyor.yml/azure-pipelines.yml, superseded by GitHub Actions.

Test plan

  • Invoke-Pester -Path Tests (all tags, Graphviz installed locally): 268/268 passed.
  • ./build.ps1 Test (-Tag Build-filtered dev loop): 237 passed, 0 failed, 31 correctly skipped (graphviz-tagged).
  • Reviewer: confirm the new GitHub Actions workflow goes green on all three OSes once this PR's checks run.

This is Phase 2 of plans/modernization-roadmap.md, following Phase 1 (#1). Phase 3 (Graphviz coverage & PowerShell integration) is planned to follow once this merges.

https://claude.ai/code/session_014u9G91TefcQ42MAGvWrrqK

exactmike and others added 2 commits August 29, 2026 08:17
- PSGraph.psd1: pin PowerShellVersion to '7.0'.
- Migrate Tests/ off legacy Pester 3/4 `Should X` syntax to Pester 5
  `Should -X`, including several lowercase-verb and typo'd forms the
  simple rename missed.
- Fix a real Pester 5 migration bug, not just syntax: several test files
  computed shared fixture data (`$dot = graph g {...}`, `$functions =
  Get-Command ...`) directly in Describe/Context bodies. Under Pester 5's
  discovery/run split that data is discovery-only and evaluates to $null
  when the It blocks actually run, so these tests were never actually
  exercising anything. Fixed via BeforeAll (Export/Show-PSGraph.Tests.ps1)
  and Pester 5's -ForEach data binding (Project.Tests.ps1, and
  Tests/Project/{Help,Module}.Tests.ps1, the latter simplified from
  one-It-per-ScriptAnalyzer-violation to one aggregate It per script).
- That fix surfaced two real, previously-never-run ScriptAnalyzer
  findings: Entity.ps1 clobbered the automatic $matches variable and
  lacked a process block (suppressed with justification - it converts
  one InputObject into one Record by design, not a batch cmdlet), and
  Node.ps1 trips PSAvoidOverwritingBuiltInCmdlets (suppressed like the
  file's existing suppression, since renaming the DSL keyword is out of
  scope here).
- Pin Pester to 5.7.1 in build.ps1 (this machine had 4.10.1 and 5.7.1
  side by side, leaving Invoke-Pester resolution ambiguous) and add
  -AllowClobber to the module installs, needed on any machine/runner
  that already has a module providing the same command names as
  BuildHelpers.
- Modernize BuildTasks/Pester.Task.ps1 from Pester 5's deprecated legacy
  simple-parameter Invoke-Pester call to New-PesterConfiguration.
- Add .github/workflows/ci.yml: ubuntu/windows/macos x pwsh matrix,
  installs Graphviz on every runner and runs the full Tests/ suite
  untagged (not the -Tag Build filter BuildTasks/Pester.Task.ps1 uses
  for the fast local dev loop) - closing a real gap where the
  graphviz-tagged Export-PSGraph/Show-PSGraph tests, plus the untagged
  Edge/Row tests, never actually ran under the old Tag-Build-filtered
  pipeline.
- Remove psake.ps1 (confirmed dead: absent from build.ps1's module list
  and unreferenced by both CI configs it's meant to serve) and the
  appveyor.yml/azure-pipelines.yml it's superseded by GitHub Actions.

Verified: `Invoke-Pester -Path Tests` (all tags, Graphviz installed)
and `./build.ps1 Test` (Tag Build-filtered) both pass clean:
268/268 and 237/237 respectively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014u9G91TefcQ42MAGvWrrqK
…macOS

Tests built paths like "\$testdrive\bom.dot" with a literal backslash,
which isn't a path separator on Linux/macOS. These graphviz-tagged tests
never ran anywhere before Phase 2's CI actually installed Graphviz and
exercised them cross-platform, so nothing caught it until now. Switched
to Join-Path throughout.

Confirmed via the actual GitHub Actions run on PR #2: this was the exact
failure on ubuntu-latest and macos-latest (windows-latest already
passed, since \ is a real separator there).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014u9G91TefcQ42MAGvWrrqK
@exactmike
exactmike merged commit 10c024b into master Aug 29, 2026
3 checks passed
@exactmike
exactmike deleted the phase2/ps7-modernization-ci branch August 29, 2026 13:15
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.

1 participant