New to Pester, installed Powershell and Pester on Ubuntu 16.04 per instructions on the Pester Github page https://github.com/pester/Pester. Executed their sample scripts Get-Planet.Tests.ps1 and Get-Planet.ps1 and it worked as advertised. Tried the same thing on Windows 10 following their instructions, and got "-Be is not a valid Should operator".
Not sure where to look for the problem, as I'm new to Pester and to Powershell as well. It's their own sample, installed per their instructions, with no modifications. Any help will be appreciated.
To expand on the other answer, Windows 10 (and Server 2016) come with Pester version 3.4.0 pre-installed. From version 4 of Pester onward some Pester syntax was changed, including the Should
assertions which are now provided as parameters (e.g Should Be
became Should -Be
).
The documentation reflects the newer syntax, hence why it is misleading for older versions of Pester.
You can install the latest version of Pester on your Windows 10 machine, by running the following with an admin-level PowerShell window:
Install-Module -Name Pester -Force -SkipPublisherCheck
To see what else changed between Pester versions 3 and 4, see here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With