Fix test where Export-Alias * fails when only single file exists#2953
Fix test where Export-Alias * fails when only single file exists#2953mirichmo merged 2 commits intoPowerShell:masterPowerShell/PowerShell:masterfrom adityapatwardhan:ExportAliasTestadityapatwardhan/PowerShell:ExportAliasTestCopy head branch name to clipboard
Conversation
The test expects multiple files to be present at the location. We explicitly create multiple files now under $TestDrive and use that the location for Export-Alias Also, so test structure changes.
|
@JamesWTruher can you have a look. |
| } | ||
| } | ||
|
|
||
| Remove-Item -Path $testAliasDirectory -Recurse -Force |
There was a problem hiding this comment.
Remove-Item -Path $testAliasDirectory -Recurse -Force [](start = 4, length = 53)
this should probably be removed as it's done automatically when $TESTDRIVE is cleaned up
| BeforeEach { | ||
| New-Item -Path $testAliasDirectory -ItemType Directory -Force | ||
| New-Item -Path $testAliasDirectory -ItemType Directory -Force | ||
| } |
There was a problem hiding this comment.
should probably add cleanup in an AfterEach as it looks like we're creating each time (and new-item -force doesn't remove the directory if it exists)
|
@JamesWTruher Addressed CR comments. |
|
|
| } | ||
| finally{ | ||
| Remove-Item $TestDrive\foo -Force -ErrorAction SilentlyContinue | ||
| Remove-Item $TestDrive\bar -Force -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
$TestDrive is cleaned up automatically. Maybe remove this two lines?
There was a problem hiding this comment.
$TestDrive is cleaned up only when the Describe or Context block is finished. These files are cleaned up in finally so that they do not interfere with other tests in subsequent It blocks.
…erShell#2953) * Fix test where Export-Alias * fails when only single file exists The test expects multiple files to be present at the location. We explicitly create multiple files now under $TestDrive and use that the location for Export-Alias Also, so test structure changes. * Address code review comments
The test expects multiple files to be present at the location. We
explicitly create multiple files now under $TestDrive and use that the
location for Export-Alias
Also, so test structure changes.