Pester icon indicating copy to clipboard operation
Pester copied to clipboard

Ignore errors when Pester fails to delete files from the test drive

Open splatteredbits opened this issue 4 years ago • 1 comments

Summary of the feature request

Currently, if Pester fails to delete files from the test drive after a test completes, you see a bunch of errors. Because of PowerShell's verbose error formats, you usually get a wall of red text and it's hard to figure out if a test failed or not. We havesome tests that load an assembly into PowerShell from the test drive. PowerShell locks all the assembly files it has loaded, which causes Pester's Remove-Item call to write errors.

Since the user can't do anything about whether or not Pester successfully cleaned up the test drive and it has no impact on whether or not a test succeeds, Pester should ignore these errors completely, or at the very list silently continue past them.

splatteredbits avatar Nov 18 '21 23:11 splatteredbits

I agree for this particular case, but I don't think it is a great default behavior for test drive, because there are most likely others that rely on the file actually being removed. If failing to remove a file does not fail the test, then I would consider that a bug rather than a feature.

We could somehow configure this, but it seems like configuring this on a case by case basis would be the best, e.g. by adding the file to a whitelist.

nohwnd avatar Nov 19 '21 09:11 nohwnd