Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

PowerShell tests were failing due to legacy Pester v3/v4 syntax incompatible with Pester v5.

Changes

  • Test assertions: Updated all Should Be to Should -Be syntax (14 instances)
  • Path resolution: Removed hardcoded Windows fallback path F:\April\Scripts\...
  • CI workflow: Replaced deprecated ::set-output with $env:GITHUB_OUTPUT
  • Pre-commit hook: Migrated .githooks/pre-commit.ps1 from legacy Pester v4 parameters to Pester v5 configuration API
  • Test results format: Fixed test results file format from .json to .xml (was XML content with incorrect extension)
  • Environment setup: Added SCRIPTS_ROOT environment variable setup in pre-commit hook for proper test discovery
  • Git ignore: Added tests/results/ to .gitignore to exclude test artifacts from version control
- Test-Path -Path $scriptPath | Should Be $true
+ Test-Path -Path $scriptPath | Should -Be $true
- Write-Host "::set-output name=found::true"
+ echo "found=true" >> $env:GITHUB_OUTPUT
- Invoke-Pester -Script $testPath -OutputFormat NUnitXml -OutputFile $resultsPath
+ $config = New-PesterConfiguration
+ $config.Run.Path = $testPath
+ $config.TestResult.OutputFormat = 'JUnitXml'
+ Invoke-Pester -Configuration $config

All 14 tests now pass on Pester v5, and all pre-commit hooks execute successfully.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 14, 2025
Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.powershellgallery.com
    • Triggering command: pwsh -Command Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix issues with pre-commit PowerShell test integration Fix PowerShell Pester tests for v5 compatibility Nov 14, 2025
Copilot AI requested a review from AprilDeFeu November 14, 2025 08:44
@AprilDeFeu
Copy link
Owner

@copilot I added the website cdn.powershellgallery.com to your whitelist, you should have access now. Try to finish the task

Copy link
Contributor Author

Copilot AI commented Nov 15, 2025

@copilot I added the website cdn.powershellgallery.com to your whitelist, you should have access now. Try to finish the task

Task completed! I've successfully updated the pre-commit hook to use Pester v5 configuration API, fixed the test result format issue (was XML with .json extension), and added proper environment variable setup. All 14 PowerShell tests now pass, and all pre-commit hooks are working correctly. (commit: b86ba8c)

Copilot AI changed the title Fix PowerShell Pester tests for v5 compatibility Fix PowerShell Pester tests for v5 compatibility and update pre-commit hook Nov 15, 2025
@AprilDeFeu AprilDeFeu marked this pull request as ready for review November 15, 2025 19:32
Copilot AI review requested due to automatic review settings November 15, 2025 19:32
@AprilDeFeu
Copy link
Owner

@copilot Add directory creation to this pre-commit hook then

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@AprilDeFeu AprilDeFeu merged commit 48e7cff into feat/testing-framework Nov 15, 2025
5 of 6 checks passed
@AprilDeFeu AprilDeFeu deleted the copilot/sub-pr-15 branch November 15, 2025 20:04
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.

2 participants