Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

PowerShell integration tests were failing due to help output not being captured and path separator mismatches between Windows/Linux test environments.

Changes

Help Output Capture

  • Changed Write-HostWrite-Output in help sections
  • Enables test capture via 2>&1 | Out-String redirection

Platform-Aware Path Resolution

  • Updated Resolve-MountPath to detect OS and use appropriate path separators:
    • Windows: backslashes, $env:USERPROFILE
    • Linux: forward slashes, $env:HOME
  • Added platform-specific sensitive path patterns

Test Updates

  • Made absolute path test platform-aware
  • Removed test for non-existent -DryRun parameter

Cross-Platform Test Enablement

  • Updated tests/run_all_tests.sh to run PowerShell integration tests on Linux/macOS
  • Previously restricted to Windows only due to compatibility issues
  • Now runs on all platforms with platform-aware fixes
# Before: writes to console, uncapturable
Write-Host @"
USAGE:
  Copilot-Here [OPTIONS]
"@

# After: writes to output stream
Write-Output @"
USAGE:
  Copilot-Here [OPTIONS]
"@
# Platform-aware path handling
if ([RuntimeInformation]::IsOSPlatform([OSPlatform]::Windows)) {
    $resolvedPath = $resolvedPath.Replace('/', '\')
} else {
    $resolvedPath = $resolvedPath.Replace('\', '/')
}

Testing

  • ✅ All 11 PowerShell integration tests pass on Windows, Linux, and macOS
  • ✅ Test suite count increased from 5 to 6 on Linux/macOS
  • ✅ All existing bash, zsh, and docker tests continue to pass
Original prompt

can you help me fix this error in my new tests

https://github.com/GordonBeeming/copilot_here/actions/runs/19233516301/job/54977447582


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Change Write-Host to Write-Output for help text capture
- Make Resolve-MountPath platform-aware (Windows/Linux)
- Make tests platform-aware for path testing
- Remove DryRun parameter test (feature doesn't exist)

Co-authored-by: Gordon Beeming <me@gordonbeeming.com>

Co-authored-by: GordonBeeming <5680199+GordonBeeming@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error in new test cases Fix PowerShell test failures: output capture and platform-aware path handling Nov 10, 2025
Copilot AI requested a review from GordonBeeming November 10, 2025 13:48
@GordonBeeming
Copy link
Owner

@copilot There are some tests that were only running on windows and not linux/mac... With the changes made can those now run everywhere?

With the platform-aware fixes, test_powershell.ps1 now works on all platforms, not just Windows. Updated run_all_tests.sh to run these tests on Linux/macOS too.

Co-authored-by: Gordon Beeming <me@gordonbeeming.com>

Co-authored-by: GordonBeeming <5680199+GordonBeeming@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 10, 2025

@copilot There are some tests that were only running on windows and not linux/mac... With the changes made can those now run everywhere?

Yes! The platform-aware changes now allow test_powershell.ps1 to run on Linux/macOS too.

I updated run_all_tests.sh to enable these tests on all platforms (commit 5e84f25). The test runner now runs 6 test suites instead of 5 on Linux/macOS:

  • Bash tests ✅
  • PowerShell integration tests ✅ (newly enabled)
  • PowerShell basic tests ✅
  • Docker command tests ✅
  • Mount configuration tests ✅

All PowerShell integration tests pass on Linux with the platform-aware path handling.

Copilot AI changed the title Fix PowerShell test failures: output capture and platform-aware path handling Fix PowerShell test failures and enable cross-platform testing Nov 10, 2025
@GordonBeeming GordonBeeming marked this pull request as ready for review November 10, 2025 14:13
Copilot AI review requested due to automatic review settings November 10, 2025 14:13
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.

Pull Request Overview

This pull request enhances the PowerShell script to support cross-platform execution (Windows, Linux, macOS) by making the path handling logic platform-aware and updating the test suite to run on all platforms.

Key Changes

  • Cross-platform path handling: The Resolve-MountPath function now detects the operating system and normalizes path separators accordingly (backslashes for Windows, forward slashes for Linux/macOS)
  • Home directory expansion: Updated to support both $env:USERPROFILE (Windows) and $env:HOME (Linux/macOS)
  • Test improvements: PowerShell tests now run on all platforms with platform-specific absolute path validation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
copilot_here.ps1 Added cross-platform path normalization using OS detection, updated home directory expansion for both Windows and Linux, changed help output from Write-Host to Write-Output
tests/integration/test_powershell.ps1 Added platform-specific absolute path tests using OS detection, removed obsolete DryRun parameter test
tests/run_all_tests.sh Removed Windows-only restriction for PowerShell tests, enabling cross-platform test execution

@GordonBeeming GordonBeeming merged commit a4db611 into main Nov 10, 2025
14 checks passed
@GordonBeeming GordonBeeming deleted the copilot/fix-new-tests-error branch November 10, 2025 15:10
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