Fix #2628 and #2474: LiteralPath for Should -Exist and DirectoryInfo display loop#2686
Closed
nohwnd wants to merge 1 commit intopester:mainfrom
Closed
Fix #2628 and #2474: LiteralPath for Should -Exist and DirectoryInfo display loop#2686nohwnd wants to merge 1 commit intopester:mainfrom
nohwnd wants to merge 1 commit intopester:mainfrom
Conversation
…rectoryInfo display loop pester#2628: Should -Exist now uses Test-Path -LiteralPath instead of Test-Path so paths with wildcard characters ([ ]) work correctly. pester#2474: Added DirectoryInfo and FileInfo to the display property map in Get-DisplayProperty2 to prevent infinite recursion from circular Root/Directory properties. Copilot-generated fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nohwnd
commented
Apr 3, 2026
Comment on lines
-14
to
-16
| It 'works for path with escaped [ ] characters' { | ||
| It 'works for path with literal [ ] characters' { | ||
| New-Item -Path "TestDrive:\[test].txt" -ItemType File | Out-Null | ||
| "TestDrive:\``[test``].txt" | Should -Exist |
Member
Author
There was a problem hiding this comment.
revert this and follow the design, the default behavior of Should -Exist has to remain the same ( a thin wrapper over Test-Path) and additional -LiteralPath parameter for specifying escaped path, following the semantics of Test-Path
Member
Author
|
Fix for Fix #2474: DirectoryInfo/FileInfo infinite loop prevention is good, but split to its own PR. |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pester 6 Fixes (Copilot-generated)
Fix #2628: Should -Exist uses -LiteralPath
Changed
Test-PathtoTest-Path -LiteralPathso paths with wildcard characters like[and]are found correctly.Fix #2474: DirectoryInfo/FileInfo infinite loop prevention
Added
System.IO.DirectoryInfoandSystem.IO.FileInfoto the display property map inGet-DisplayProperty2to prevent infinite recursion from circularRoot/Directoryproperties.All 2154 tests pass locally.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com