tests(pester): Update to Pester 5 #5222
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Initial works to refactor Scoop Core tests.
Adapt to Pester 5 for all the tests, and this may not compatible with current bucket tests (must explicitly require Pester 5, which is 4 now)
I've tried my best to make
Import-Bucket-Tests.ps1
be compatible with Pester 4, but haven't found the solution. The first run in bucket always breaks the test, while the second run is succeed. But in buckets' CI, the process only run once. The bug here is Pester 5'sDiscovery and Run
feature runsDiscovery
in its own folder, and deprecate the use of$MyInvocation.PSScriptRoot
or$MyInvocation.PSCommandPath
in tests, so I could not pass correct folder parameter to the tests.Motivation and Context
The tests in Scoop should be refactored and reorgnized to reflect the growing code base, and the first step is using Pester 5.
How Has This Been Tested?
Now it has 130 tests in total, and 31 of them are only for Windows.
Windows:
Ubuntu:
Checklist:
develop
branch.