Fix Start-PSPester
to include or exclude 'RequireSudoOnUnix' tag smartly on Unix (#6241)
If `-sudo` is specified, make sure to include 'RequireSudoOnUnix' tag on Unix if the 'Tag' is not specified. If `-sudo` is not specified, make sure to exclude `RequireSudoOnUnix` tag on Unix if the 'ExcludeTag' is not specified.
This commit is contained in:
parent
5030c9a2fd
commit
e95f0099ed
14
build.psm1
14
build.psm1
|
@ -1025,6 +1025,20 @@ Restore the module to '$Pester' by running:
|
|||
$ExcludeTag += 'RequireAdminOnWindows'
|
||||
}
|
||||
}
|
||||
elseif (-not $Environment.IsWindows -and (-not $Sudo.IsPresent))
|
||||
{
|
||||
if (-not $PSBoundParameters.ContainsKey('ExcludeTag'))
|
||||
{
|
||||
$ExcludeTag += 'RequireSudoOnUnix'
|
||||
}
|
||||
}
|
||||
elseif (-not $Environment.IsWindows -and $Sudo.IsPresent)
|
||||
{
|
||||
if (-not $PSBoundParameters.ContainsKey('Tag'))
|
||||
{
|
||||
$Tag = 'RequireSudoOnUnix'
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Running pester tests at '$path' with tag '$($Tag -join ''', ''')' and ExcludeTag '$($ExcludeTag -join ''', ''')'" -Verbose
|
||||
Publish-PSTestTools | ForEach-Object {Write-Host $_}
|
||||
|
|
Loading…
Reference in a new issue