Pester
Pester copied to clipboard
Shorten length of temp directory name
Checklist
- [X] Feature request has a meaningful title
- [X] I have searched the existing issues. See all issues
- [X] I have tested using the latest version of Pester. See Installation and update guide.
Summary of the feature request
As a Pester user on Windows, I sometimes get failures due to Windows' 260 character max path limitation. When Pester creates the temp directory for its test drive, it uses a Guid, which is 36 characters long, e.g. C:\Users\username\AppData\Local\Temp\19718499-6c05-4f67-bc4c-344f5c47c7bd.
Please shorten this to a four character directory name. This is what [IO.Path]::GetRandomFileName() uses for uniqueness. This saves 32 characters in the path.
How should it work?
Instead of using an entire GUID for the temp directory name, use just the first four characters. Change this (in TestDrive.ps1):
$Path = [IO.Path]::Combine($tempPath, ([Guid]::NewGuid()))
to
$Path = [IO.Path]::Combine($tempPath, ([Guid]::NewGuid().ToString().Substring(0, 4)))
PR incoming...