pester / Pester

Pester is the ubiquitous test and mock framework for PowerShell.
https://pester.dev/
Other
3.08k stars 470 forks source link

Exception running invoke-pester #141

Closed ghostsquad closed 10 years ago

ghostsquad commented 10 years ago
C:\dev\tests\powershell [default -1 ?73 dpm, qbase, qtip, tip]> Invoke-Pester -testName S3Push
Executing all tests in C:\dev\tests\powershell
Method invocation failed because [System.Collections.Hashtable] does not contain a method named 'EnterDescribe'.
At C:\dev\tests\powershell\pester\Functions\Describe.ps1:69 char:2
+     $Pester.EnterDescribe($Name)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Write-Describe : The term 'Write-Describe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At C:\dev\tests\powershell\pester\Functions\Describe.ps1:70 char:31
+     $Pester.CurrentDescribe | Write-Describe
+                               ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Write-Describe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

[-]  records the correct stack line number of failed tests 24ms
 Expected: {} to match the expression {at line: 5 in }
 at line: 21 in C:\dev\tests\powershell\pester\Functions\It.Tests.ps1
[+]  should pass if assertions pass 1ms
[+]  throws if no test block given 2ms
[+]  test block 0ms
[+]  won't throw if success test block given 7ms
[+]  tests 0ms
[+]  Does not rewrite Test variable 6ms
[+]  does not override the pester variable 0ms
Method invocation failed because [System.Collections.Hashtable] does not contain a method named 'LeaveDescribe'.
At C:\dev\tests\powershell\pester\Functions\Describe.ps1:77 char:2
+     $Pester.LeaveDescribe()
+     ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Tests completed in 43ms
Passed: 7 Failed: 1

Two problems going on here.. 1: I asked it to run just my test.. and it runs all of them?? 2: obviously, the exception at hand..

dlwyatt commented 10 years ago

The output is misleading; it should probably say something like "Running all test in 'path' that match test name 'Whatever'".

That said, I can't reproduce the error. What version of Pester are you using?

dlwyatt commented 10 years ago

All of the errors mentioned so far center around code found in Functions\PesterState.ps1 , by the way. This is total speculation, but maybe you have an older version of just that file, in combination with newer versions of the rest of the module's code.

Edit: Scratch that. What you have is an older version of Pester.psm1, in combination with newer versions of at least some of the PS1 files in the Functions directory. If you delete the module and download the latest version, you should be fine.

ghostsquad commented 10 years ago

Thanks. I've deleted the entire module and redownloaded. Not sure how that happened.