Make Move-Item work with its -Include, -Exclude, and -Filter parameters#3878
Make Move-Item work with its -Include, -Exclude, and -Filter parameters#3878TravisEz13 merged 4 commits intoPowerShell:masterfrom jeffbi:move-item-2385
Conversation
…rs (#2385) Invoke the correct overload of SessionState.Path.GetResolvedPSPathFromPSPath, passing the cmdlet context object.
|
@iSazonov Can you take a look at the Appveyor failure? I'm looking at the details and they seem to show two failure points, neither of which have anything to do with this PR. |
|
@jeffbi I see the same in other PRs. Nightly builds is affected too. |
iSazonov
left a comment
There was a problem hiding this comment.
Original Issue say that the cmdlet works well but writes unexpected error message - I don't see the check in tests.
|
@iSazonov Well, what it actually said what that the cmdlet successfully performed the action that was intended, then wrote an error. That's not quite the same as it worked well. I've updated the tests to check that the |
|
LGTM. |
| $booContent = "boo content" | ||
| } | ||
| BeforeEach { | ||
| New-Item -ItemType Directory -Path $filterPath |
There was a problem hiding this comment.
Should be
New-Item -ItemType Directory -Path $filterPath | Out-Nullto avoid on console output of created item
| It "Can move to different directory, filtered with -Include" { | ||
| Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" | ||
| $? | Should Be $true | ||
| Test-Path -Path $barPath | Should Be $false |
There was a problem hiding this comment.
Use Powershell $barPath | Should Not Exist"
| } | ||
| It "Can move to different directory, filtered with -Include" { | ||
| Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" | ||
| $? | Should Be $true |
There was a problem hiding this comment.
Difficult to debug from logs. Instead use
Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" -ErrorVariable e -ErrorAction SilentlyContinue
$e | Should BeNullOrEmpty| It "Can move to different directory, filtered with -Include" { | ||
| Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" -ErrorVariable e -ErrorAction SilentlyContinue | ||
| $e | Should BeNullOrEmpty | ||
| #Test-Path -Path $barPath | Should Be $false |
There was a problem hiding this comment.
Please remove the comment.
|
@jeffbi Thanks for the fix! LGTM. (After removing one unneeded comment) |
|
@iSazonov, @adityapatwardhan Thanks for the review. |
|
@jeffbi Can you update or remove the company in your profile? If it is accurate, please email me internally about additional steps you need to take. @adityapatwardhan Please make your Microsoft Organization membership public. |
Fixed #2385
Invoke the correct overload of SessionState.Path.GetResolvedPSPathFromPSPath, passing the cmdlet context object.