-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#128) - `Restore-TestEnvironment` - A new parameter `KeepNewMachinePSModulePath` was added and only works if the test type is `Integration` or `All`. The new parameter will keep any new paths that was added to the machine environment variable `PSModulePath` after the command `Initialize-TestEnvironment` was called. This is helpful if a a path is added by an integration test and is needed by a second integration test and there is a need to run `Restore-TestEnvironment` between tests. - Added private function `Join-PSModulePath` that will concatenate two strings with semi-colon separated paths. - `Initialize-TestEnvironment` - Now `$script:machineOldPSModulePath` is always set when called with the test type `Integration` or `All`. Before it reverted to the paths on the event `OnRemove` that were the current paths when `Initialize-TestEnvironment` was first called. On subsequent calls any new paths were ignored. - If there are a subsequent call to `Initialize-TestEnvironment` without the command `Restore-TestEnvironment` was called prior the command will now fail with a non-terminating exception asking the user to run `Restore-TestEnvironment` to avoid the previously saved paths (`$script:machineOldPSModulePath`) to be overwritten.
- Loading branch information
Showing
8 changed files
with
154 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
<# | ||
.SYNOPSIS | ||
Concatenates two string that contain semi-colon separated strings. | ||
.PARAMETER Path | ||
A string with all the paths separated by semi-colons. | ||
.PARAMETER NewPath | ||
A string with all the paths separated by semi-colons. | ||
.EXAMPLE | ||
Join-PSModulePath -Path '<Path 1>;<Path 2>' -NewPath 'Path3;Path4' | ||
#> | ||
function Join-PSModulePath | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.String])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] | ||
$Path, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] | ||
$NewPath | ||
) | ||
|
||
foreach ($currentNewPath in ($NewPath -split ';')) | ||
{ | ||
if ($Path -cnotmatch [System.Text.RegularExpressions.Regex]::Escape($currentNewPath)) | ||
{ | ||
$Path = @($Path, $currentNewPath) -join ';' | ||
} | ||
} | ||
|
||
return $Path | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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