Add GitHub Actions annotations for Pester test failures by Copilot · Pull Request #26789 · PowerShell/PowerShell
- Added Get-PesterFailureFileInfo helper function to parse stack traces - Modified Show-PSPesterError to emit GitHub workflow error annotations with file/line info - Added links to test logs when running in GitHub Actions - Maintains backward compatibility when not in a GitHub workflow Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
- Added support for Pester 5 stack trace format (e.g., "at X, /path:line") - Handle both Unix and Windows paths in all regex patterns - Verified parsing with multiple test cases including real Pester output Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add comments to test code with failure details
Add GitHub Actions annotations for Pester test failures
TravisEz13
added
the
CL-Test
label
- GitHub Actions expects paths relative to workspace root, not absolute paths - Added path conversion logic using GITHUB_WORKSPACE environment variable - Normalizes paths to use forward slashes for consistency - Handles both Unix and Windows absolute paths - Relative paths remain unchanged Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
- Added test in ciModule.Tests.ps1 to demonstrate the annotation feature - Test intentionally fails to show annotations in CI output - Verifies relative path conversion and test log links - Can be removed after feature is verified in actual CI runs Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
- Removed test from ciModule.Tests.ps1 that manually called Show-PSPesterError - Created DemoGitHubAnnotations.Tests.ps1 in test/powershell/Modules/ - New test runs through normal Pester execution and Test-PSPesterResults - Demonstrates actual code path: Pester test fails -> Test-PSPesterResults -> Show-PSPesterError -> annotations - Tagged with 'CI' so it runs in normal CI workflows - DELETE DemoGitHubAnnotations.Tests.ps1 after verifying feature in production Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
- Moved GitHub Actions annotation logic from Show-PSPesterError to process-pester-results.ps1 - process-pester-results.ps1 is the central place where test results are processed in CI - Removed redundant GITHUB_WORKFLOW check (already in workflow context) - Show-PSPesterError now only displays error info (backward compatible) - Get-PesterFailureFileInfo remains in build.psm1 for reuse Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Copilot AI review requested due to automatic review settings
TravisEz13
deleted the
copilot/add-comments-on-test-failures
branch
TravisEz13 added a commit to TravisEz13/PowerShell that referenced this pull request
…6789) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
daxian-dbw pushed a commit to daxian-dbw/PowerShell that referenced this pull request
…6789) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
daxian-dbw pushed a commit to daxian-dbw/PowerShell that referenced this pull request
…6789) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
daxian-dbw pushed a commit to daxian-dbw/PowerShell that referenced this pull request
…6789) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
JustinGrote pushed a commit to JustinGrote/PowerShell that referenced this pull request
…6789) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>