Skip to content

Commit 6b33792

Browse files
nohwndCopilot
andcommitted
Fix #2515: Include hidden folders in test discovery on Linux
Copilot-generated fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d5f7c87 commit 6b33792

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Pester.RSpec.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
foreach ($item in $items) {
3131
if ($item.PSIsContainer) {
3232
# this is an existing directory search it for tests file
33-
& $SafeCommands['Get-ChildItem'] -Recurse -Path $item -Filter "*$Extension" -File
33+
# use -Force to include hidden items (e.g. dot-prefixed folders on Linux)
34+
& $SafeCommands['Get-ChildItem'] -Recurse -Path $item -Filter "*$Extension" -File -Force
3435
}
3536
elseif ("FileSystem" -ne $item.PSProvider.Name) {
3637
# item is not a directory and exists but is not a file so we are not interested
@@ -60,7 +61,8 @@
6061
else {
6162
# this is a path that does not exist so let's hope it is
6263
# a wildcarded path that will resolve to some files
63-
& $SafeCommands['Get-ChildItem'] -Recurse -Path $p -Filter "*$Extension" -File
64+
# use -Force to include hidden items (e.g. dot-prefixed folders on Linux)
65+
& $SafeCommands['Get-ChildItem'] -Recurse -Path $p -Filter "*$Extension" -File -Force
6466
}
6567
}
6668

0 commit comments

Comments
 (0)