Closed Strandedpirate closed 2 years ago
If I do what the error suggests and re-run, I get another slew of errors.
PS F:\git\kanopy\Scripts> Invoke-Pester .\Get-Planet.Tests.ps1
Describing Get-Planet
[-] Given no parameters, it lists all 8 planets 494ms
RuntimeException: '-Be' is not a valid Should operator.
at Get-TestResult, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1: line 42
at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 26
Context Filtering by Name
[-] Given valid -Name 'Earth', it returns 'Earth' 206ms
RuntimeException: '-Be' is not a valid Should operator.
at Get-TestResult, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1: line 42
at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 39
[-] Given valid -Name 'ne*', it returns 'Neptune' 61ms
RuntimeException: '-Be' is not a valid Should operator.
at Get-TestResult, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1: line 42
at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 39
[-] Given valid -Name 'ur*', it returns 'Uranus' 82ms
RuntimeException: '-Be' is not a valid Should operator.
at Get-TestResult, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1: line 42
at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 39
[-] Given valid -Name 'm*', it returns 'Mercury Mars' 84ms
RuntimeException: '-Be' is not a valid Should operator.
at Get-TestResult, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1: line 42
at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 39
[-] Given invalid parameter -Name 'Alpha Centauri', it returns $null 90ms
RuntimeException: '-Be' is not a valid Should operator.
at Get-TestResult, C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Functions\Assertions\Should.ps1: line 42
at <ScriptBlock>, F:\git\kanopy\Scripts\Get-Planet.Tests.ps1: line 44
Tests completed in 1.02s
Passed: 0 Failed: 6 Skipped: 0 Pending: 0 Inconclusive: 0
Ok, not an issue. I figured it out. I just built a new system a few months back and kept the old hard drive in the computer. I must have installed Pester a few years back on that old drive and somehow the new windows install picked up the old module.? ¯_(ツ)_/¯.
So basically I was running on 3.4. Powershell refused to uninstall the old module, denies that it even existed. So I just renamed the old folder and installed the newest per docs.
C:\Program Files\WindowsPowerShell\Modules\Pester.old
I must be missing something obvious. None of the quick start guides in these two locations work.
https://github.com/pester/Pester https://pester.dev/docs/quick-start
Output
Get-Planet.Tests.ps1