You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With TestCases being evaluated during the discovery phase, it is no longer possible to account for the TestDrive value be available when TestCases value is defined. For that same reason, a variable that's used for TestCases cannot be defined within the BeforeAll block.
2. Describe Your Environment
Pester version : 5.0.2 C:\Users\seriavio\Documents\PowerShell\Modules\Pester\5.0.2\Pester.psd1
PowerShell version : 7.0.0
OS version : Microsoft Windows NT 10.0.18363.0
3. Expected Behavior
In 4th version of the Pester module, this was working fine, but in 5th, I'll have update the test code by embedding the value of the TestDrive directly within test itself.
4.Current Behavior
All mentions of TestDrive within the TestCases are replaced with null.
5. Possible Solution
Update the code within the It block to dynamically update the provided TestCases instance value with the actual value of a TestDrive variable
6. Context
I discovered the issue when I was trying to move my tests to Pester 5. In this case, I'll be able to update my code, but I think that this should be added to the list of Breaking Changes maybe?
The text was updated successfully, but these errors were encountered:
More generally, the scoping of TestCases is a bit of a pain now - I have to duplicate the code in BeforeAll within the Describe block because I use the same setup to create TestCases as I do within the tests themselves. There could do with being a global scope or something where you can do setup that is available in Discovery and Run
1. General summary of the issue
With
TestCases
being evaluated during the discovery phase, it is no longer possible to account for theTestDrive
value be available whenTestCases
value is defined. For that same reason, a variable that's used forTestCases
cannot be defined within theBeforeAll
block.2. Describe Your Environment
3. Expected Behavior
In 4th version of the Pester module, this was working fine, but in 5th, I'll have update the test code by embedding the value of the
TestDrive
directly within test itself.4.Current Behavior
All mentions of
TestDrive
within theTestCases
are replaced withnull
.5. Possible Solution
Update the code within the
It
block to dynamically update the providedTestCases
instance value with the actual value of aTestDrive
variable6. Context
I discovered the issue when I was trying to move my tests to Pester 5. In this case, I'll be able to update my code, but I think that this should be added to the list of
Breaking Changes
maybe?The text was updated successfully, but these errors were encountered: