diff --git a/Tests/Private/Skip-ExcludedItem.Tests.ps1 b/Tests/Private/Skip-ExcludedItem.Tests.ps1 index a926e25..0db75c9 100644 --- a/Tests/Private/Skip-ExcludedItem.Tests.ps1 +++ b/Tests/Private/Skip-ExcludedItem.Tests.ps1 @@ -39,7 +39,7 @@ Describe "Skip-ExcludedItem PS$PSVersion" { Set-Content -Path (Join-Path $Folder 'data.txt') -Value 'a' $Files = Get-ChildItem -Path $Folder - $ByPath = [WildcardPattern]::new("$Folder\*.log", 'IgnoreCase') + $ByPath = [WildcardPattern]::new((Join-Path $Folder '*.log'), 'IgnoreCase') $Result = @(Skip-ExcludedItem -InputObject $Files -Matcher $ByPath) $Result.Name | Should -Be 'data.txt' diff --git a/Tests/Public/Watch-Command.Tests.ps1 b/Tests/Public/Watch-Command.Tests.ps1 index a6edcbd..9cd249c 100644 --- a/Tests/Public/Watch-Command.Tests.ps1 +++ b/Tests/Public/Watch-Command.Tests.ps1 @@ -575,7 +575,7 @@ Describe "Watch-Command PS$PSVersion" { Get-ChildItem -Path $script:Folder } - $Result = @(Watch-Command -ScriptBlock $Sb -Key Name -Property Name, Length -Exclude "$script:Folder\*.log") + $Result = @(Watch-Command -ScriptBlock $Sb -Key Name -Property Name, Length -Exclude (Join-Path $script:Folder '*.log')) $Result.Count | Should -Be 1 $Result[0].Key | Should -Be 'data.txt' @@ -763,7 +763,9 @@ Describe "Watch-Command PS$PSVersion" { $PowerShell = [powershell]::Create() try { - $null = $PowerShell.AddCommand('Import-Module').AddParameter('Name', (Get-Module Watch).Path).Invoke() + # This runs inside the module (InModuleScope), so ask it for its own path: Get-Module Watch + # can't see the module from here, as the test file imported it into Pester's scope. + $null = $PowerShell.AddCommand('Import-Module').AddParameter('Name', $ExecutionContext.SessionState.Module.Path).Invoke() $PowerShell.Commands.Clear() $null = $PowerShell.AddCommand('Watch-Command')