-
-
Notifications
You must be signed in to change notification settings - Fork 478
Open
Description
Checklist
- Issue has a meaningful title
- I have searched the existing issues. See all issues
- I have tested using the latest version of Pester. See Installation and update guide.
What is the issue?
Tests can set current path, and we generate reports before we return to the original PWD. So the test results can be placed into a "random" folder depending on which tests user executed.
Invoke-Pester -Container (New-PesterContainer -ScriptBlock {
Describe "a" {
It "b" {
$testDrive = (Get-PSDrive TestDrive).Root
$f = New-Item -ItemType Directory -Path "$testDrive/will-delete" -Force
Set-Location $f
}
}
}) -CI
Will fail with,
Result 1 - Error 1:Resolve-Path: Cannot find path 'C:\Users\jajares\AppData\Local\Temp\f9da4b3f-18d6-4e1d-9755-db812fe31754\will-delete' because it does not exist.
at GetFullPath, C:\Users\jajares\Documents\PowerShell\Modules\Pester\5.7.1\Pester.psm1: line 17987
at Export-XmlReport, C:\Users\jajares\Documents\PowerShell\Modules\Pester\5.7.1\Pester.psm1: line 18141
at Export-PesterResult, C:\Users\jajares\Documents\PowerShell\Modules\Pester\5.7.1\Pester.psm1: line 18012
at <ScriptBlock>, C:\Users\jajares\Documents\PowerShell\Modules\Pester\5.7.1\Pester.psm1: line 18501
at Invoke-PluginStep, C:\Users\jajares\Documents\PowerShell\Modules\Pester\5.7.1\Pester.psm1: line 1800
at Invoke-Pester<End>, C:\Users\jajares\Documents\PowerShell\Modules\Pester\5.7.1\Pester.psm1: line 4991
at <ScriptBlock>, untitled:Untitled-2: line 1
at <ScriptBlock>, <No file>: line 1
Because I stepped into test drive directory, which was then cleaned up by test drive, but the report code is trying to get current path relative to the current directory.
Expected Behavior
We would reset the path to original pwd before we start writing reports, so we resolve relative to the path from which invoke-pester was invoked.
Steps To Reproduce
No response
Describe your environment
No response
Possible Solution?
No response
Metadata
Metadata
Assignees
Labels
No labels