pester / vscode-adapter

Run PowerShell Pester Tests with Visual Studio Code
MIT License
58 stars 13 forks source link

Unexpected token errors when running any test #168

Closed asa-marshall-spinen closed 1 year ago

asa-marshall-spinen commented 1 year ago

image

The above error notifications were produced using v2023.7.1

Switched to Pre-Release version and got these error notifications as well. (This could be a separate issue).

An error occurred attempting to run tests: Error: A terminating error was received from PowerShell:: Cannot bind argument to parameter 'Name' because it is an empty string. at <ScriptBlock>, C:\Users\asa.marshall\.vscode\extensions\pspester.pester-test-2073.7.4\Scripts\PesterInterface.ps1: line 77
at Register-PesterPlugin, C:\Users\asa.marshall\.vscode\extensions\pspester.pester-test-2073.7.4\Scripts\PesterInterface.ps1: line 66
at Invoke-Main, C:\Users\asa.marshall\.vscode\extensions\pspester.pester-test-2073.7.4\Scripts\PesterInterface.ps1: line 126
at <ScriptBlock>, C:\Users\asa.marshall\.vscode\extensions\pspester.pester-test-2073.7.4\Scripts\PesterInterface.ps1: line 167
at <ScriptBlock>, <No file>: line 1

and this error:

An error occured running Pester: The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
JustinGrote commented 1 year ago

Do you have a repo where your tests reside that I can confirm with?

JustinGrote commented 1 year ago

Also, are you using Pester 5.2 or later?

JustinGrote commented 1 year ago

Closing until more information is given.

asa-marshall-spinen commented 1 year ago

@JustinGrote I am currently using Pester v5.3.3. Unfortunately, the code I'm using is hosted on a private GitLab server. I might be able to publish a small portion of the repo on GitHub so that you can reproduce the issue if that would help.

JustinGrote commented 1 year ago

@JustinGrote I am currently using Pester v5.3.3. Unfortunately, the code I'm using is hosted on a private GitLab server. I might be able to publish a small portion of the repo on GitHub so that you can reproduce the issue if that would help.

I just need a reproduction, I don't need your code base :). If you can make a similar contrived example that does the same thing that would help.

asa-marshall-spinen commented 1 year ago

Thanks for your attentiveness to this issue! I've resolved it now. Pester v3.4 was still on my system from my Windows 10 installation. I removed Pester v3.4 and Pester v5.3.3, installed Pester v5.5, re-installed the Pester Tests extension, and now the tests are running great :) Thanks again!

JustinGrote commented 1 year ago

Sounds good! The latest release should detect if you are using an old pester version and warn appropriately.