Closed ChrisLGardner closed 5 months ago
Thanks for the detailed report!
The dynamic parameters are affected by your current location and -Path
. You're providing a Windows path on a Unix-system. That will fail even without mocking.
PS /workspaces/Pester/Samples> Get-ChildItem -File -Path C:\TestFolder -EA stop -Recurse -Force
Get-ChildItem: A parameter cannot be found that matches parameter name 'File'.
Remove -Path
or use a Unix-path and it should work as expected.
Checklist
What is the issue?
When mocking
Get-ChildItem
on Linux (or at least in the devcontainers I've tested it) when you then call that mock and use the-File
switch you get"A parameter cannot be found that matches parameter name 'File'."
.Debugging into this the problem appears to be that this line isn't finding the dynamic parameters on Get-ChildItem for the filesystem. I've checked that the filesystem is definitely the active provider when the mock is called and when that line is ran, Line 1488 returns the dynamic parameters correctly.
Expected Behavior
Finds and calls the correct mock of Get-ChildItem when
-File
switch is used.Steps To Reproduce
Running the following code in a devcontainer (tested in codespaces for this repo and another devcontainer for my main projects) or other Linux workspace:
Describe your environment
Pester version : 5.5.0 /home/vscode/.local/share/powershell/Modules/Pester/5.5.0/Pester.psm1
PowerShell version : 7.4.1 OS version : Unix 5.10.102.1
Possible Solution?
No response