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
As a result of discussing issue #827, this PR added a Pester option for specifying the line instead of a test name, this means that this enables us to run Pester tests that contain interpolated describe block strings. However, we cannot just simply change the syntax because we cannot rely on the latest version of Pester being installed. This outlines the high level behaviour
PSES should additionally send the line number (pesterSymbol.ScriptRegion.StartLineNumber) to the vscode extension here and here.
In the extension we need to make a decision then based on the Pester version number to determine the syntax to Invoke-Pester:
I propose to use (Get-Module -ListAvailable Pester).Version | Sort-Object -Descending | Select-Object -First 1 to retrieve the latest version. The first time it takes ~250ms, after that it's ~50ms. Should we cache the version or just always check? Or I should I do this expensive work at startup in the background? Although Get-Module has better performance compared to Get-Command, the check is not 100% accurate because one can technically import an older specific version of Pester via Import-Module and at runtime this older version would be used. Please respond and discuss this point
If the Pester version is determined to be too old, then the extension should fall back to the existing behaviour whereby it asks the user if he/she wants to Invoke-Pester just against the whole file.
Where is the best way of checking the version? Should we do this in PSES by calling into the PS API or should we pre-pend code before the Invoke-Pester call in the extension? IF PSES has the info, then I guess we would also send another boolean parameter to the extension whether to use the describeblockname or the describeblocknumber?
I propose to use (Get-Module -ListAvailable Pester).Version | Sort-Object -Descending | Select-Object -First 1 to retrieve the latest version. The first time it takes ~250ms, after that it's ~50ms. Should we cache the version or just always check? Or I should I do this expensive work at startup in the background? Although Get-Module has better performance compared to Get-Command, the check is not 100% accurate because one can technically import an older specific version of Pester via Import-Module and at runtime this older version would be used. Please respond and discuss this point
Summary of the new feature
As a result of discussing issue #827, this PR added a Pester option for specifying the line instead of a test name, this means that this enables us to run Pester tests that contain interpolated describe block strings. However, we cannot just simply change the syntax because we cannot rely on the latest version of Pester being installed. This outlines the high level behaviour
Proposed technical implementation details (optional)
pesterSymbol.ScriptRegion.StartLineNumber
) to the vscode extension here and here.(Get-Module -ListAvailable Pester).Version | Sort-Object -Descending | Select-Object -First 1
to retrieve the latest version. The first time it takes ~250ms, after that it's ~50ms. Should we cache the version or just always check? Or I should I do this expensive work at startup in the background? AlthoughGet-Module
has better performance compared toGet-Command
, the check is not 100% accurate because one can technically import an older specific version of Pester viaImport-Module
and at runtime this older version would be used. Please respond and discuss this pointInvoke-Pester
call in the extension? IF PSES has the info, then I guess we would also send another boolean parameter to the extension whether to use the describeblockname or the describeblocknumber?cc @rkeithhill @TylerLeonhardt @rjmholt for discussion
The text was updated successfully, but these errors were encountered: