I have a set of pester
tests for a PowerShell module which use the v4.0+ should
operator -FileContentMatch
. When these tests are run on a machine with an earlier v3.x version of pester
, there is a wave of error messages, none of which exactly point out the problem.
I'd like to write a simple pester
test to check for a minimum version and print an explanation / fix for the user / tester.
The extra complication is that pester
can be run directly as a script without being installed as a module on the machine.
I've looked at using $(Get-Module -ListAvailable -name "Pester").version
to pull out the pester
version, but it only sees the PowerShell-"installed" module, not the currently executing version, which, as noted, could be different.
Some signal passed from pester
would be fine, but I don't see that pester
provides any meta-information to the test scripts (ie, a version environment variable).
Any thoughts on a solution?
Aucun commentaire:
Enregistrer un commentaire