"Run Pester Tests" results in Running ... 'Powershell.RunPesterTestsFromFile' failed
See original GitHub issueIssue Description
I am experiencing a problem with running pester tests from the Action menu (Control+Shift+P). When choosing “Run Pester Tests” from this menu on a .tests.ps1 file, pester tests fail to run. An error is presented in a toast, “‘Powershell.RunPesterTestsFromFile’ failed”.
Attached Logs
The powershell extension log has nothing obviously useful. However, exthost.log has this:
[2020-05-20 16:36:18.019] [exthost] [error] TypeError: Cannot read property 'toString' of undefined
at PesterTestsFeature.launchAllTestsInActiveEditor (c:\Users\johndog\.vscode\extensions\ms-vscode.powershell-preview-2020.5.0\out\src\features\PesterTests.js:47:35)
at c:\Users\johndog\.vscode\extensions\ms-vscode.powershell-preview-2020.5.0\out\src\features\PesterTests.js:29:18
at e._executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:627:894)
at e.$executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:628:295)
at e._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:788:757)
at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:788:449)
at e._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:787:120)
at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:785:970)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:784:213
at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:67)
at v.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:232:615)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:957:179
at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:67)
at v.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:232:615)
at t.PersistentProtocol._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:237:17)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:234:155
at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:67)
at p.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:230:129)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:229:483
at Socket.t (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:238:565)
at Socket.emit (events.js:203:13)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:276:11)
at Socket.Readable.push (_stream_readable.js:210:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:166:17) PowerShell.RunPesterTestsFromFile
Environment Information
Visual Studio Code
Name | Version |
---|---|
Operating System | Windows_NT x64 10.0.19628 |
VSCode | 1.45.1 |
PowerShell Extension Version | 2020.5.0 |
PowerShell Information
Name | Value |
---|---|
PSVersion | 7.1.0-preview.3 |
PSEdition | Core |
GitCommitId | 7.1.0-preview.3 |
OS | Microsoft Windows 10.0.19628 |
Platform | Win32NT |
PSCompatibleVersions | 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.0.0 6.1.0 6.2.0 7.0.0 7.1.0-preview.3 |
PSRemotingProtocolVersion | 2.3 |
SerializationVersion | 1.1.0.1 |
WSManStackVersion | 3.0 |
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
Extension | Author | Version |
---|---|---|
code-runner | formulahendry | 0.10.0 |
code-spell-checker | streetsidesoftware | 1.9.0 |
cpptools | ms-vscode | 0.28.0 |
devinsights | Microsoft | 2020.5.7-2 |
gitlens | eamodio | 10.2.1 |
indent-one-space | usernamehw | 0.2.6 |
line-erase-game | taiki | 0.5.2 |
markdown-all-in-one | yzhang | 2.8.0 |
perl-outline | hitode909 | 0.0.6 |
powershell-preview | ms-vscode | 2020.5.0 |
rainbow-csv | mechatroner | 1.7.0 |
rewrap | stkb | 1.10.1 |
show-offset | ramyaraoa | 0.0.4 |
unique-lines | bibhasdn | 1.0.0 |
vscode-edit-csv | janisdd | 0.2.7 |
vscode-markdown-paste-image | telesoho | 0.12.3 |
vscode-markdownlint | DavidAnson | 0.35.2 |
vscode-nmake-tools | Microsoft | 3.0.200420008 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Running Pester test from within a module fails to test a private ...
This test runs successfully when running command 'Invoke-Pester -Path C:\git\FancyStyff\tests\Assert-HelperFunction.tests.ps1'.
Read more >How can I get the numer of failed tests from Invoke-Pester?
You can get the number of failed tests by using the -PassThru switch on Invoke-Pester . For example: $TestResults = Invoke-Pester -PassThru.
Read more >Invoke-Pester
The Invoke-Pester function runs Pester tests, including *.Tests.ps1 files and Pester tests in PowerShell scripts. You can run scripts that include Pester ......
Read more >I get an error trying to run my Pester test with PowerShell ...
Solution: Execute the following command using an Administrator PowerShell. Set-ExecutionPolicy -Force -Scope CurrentUser -ExecutionPolicy ...
Read more >Invoke-Pester: Running Selected Tests – SAPIEN Blog
You can even use Invoke-Pester to run PowerShell scripts that contain no tests, like my PowerShell profile. It dutifully reports that no tests...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve fixed this in #2730. Now the
Run Pester Tests
runs the Pester tests in the file.It’s available in the 2020.6.0 version of PowerShell Preview extension.