-
Notifications
You must be signed in to change notification settings - Fork 511
Pester describe block "Run tests" and "Debug tests" do not run #1500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @jchris1, thanks for opening an issue. If you remove the |
Hi, Yes. I have the same error with this example test block: Describe "test" {
It {
1 | Should Be 1
}
} |
Ah I've worked it out. This Pester test isn't valid because the Describe "test" {
It "my test" {
1 | Should -Be 1
}
} The Pester CodeLens will only recognise valid Pester tests, since it can't run them otherwise. Try that and let us know how it goes. I'd also be interested to know if re-instating the |
I get the same behavior whether or not the It block has a name. In both cases, the clickable text ("Run tests" and "Debug tests") appears above the Describe block. And in both cases if I click "Run tests" or "Debug Tests", I get the error. Describe "test" {
it {
1 | Should Be 1
}
}
Describe "test" {
it "my test" {
1 | Should Be 1
}
} Side note: If I remove the Describe name, then "Run tests" and "Debug Tests" disappear, so it does seem a Describe name is required to be recognized as a Pester test, but not an It test name. If I run these two tests using Invoke-Pester, I do get a Pester error for the top case without an It test name. |
It looks like you're using the older style of Pester asserts. Can you do 3 things:
|
@jchris1 Can you also paste any output (e.g. error output) you get from clicking on |
I've tried this out on my machine now. If I do: Describe "tests" {
It " test" {
1 | Should Be 1
}
} or Describe "tests" {
if (1)
{
It " test" {
1 | Should Be 1
}
}
} I get an output like:
If I don't provide the name of the test like Describe "test" {
It {
1 | Should Be 1
}
} gives
The Also, the Pester lens only appears in files that end with But so far I've been unable to reproduce the behaviour you're seeing @jchris1. |
Installed Pester version is 4.4.0 Using this test block saved as file.tests.ps1
I can manually run the test in the terminal:
And like before, when I click "Run tests" or "Debug tests" I get the error: |
Thanks for all your effort so far! With this new version, can you please attach the logs? Before you do that can you set the log level to "Diagnostic":
|
I clicked "Run Tests" and "Debug Tests" and got the same error. Here are the logs: EditorServices.log |
Relevant section from the logs:
The logs don't reveal much other than it looks like not a whole lot is happening. I'll see if I can look into this this week. |
* Fix Pester CodeLens not working for running/debugging tests Fixes #1500 * Single quote/escape script path passed in -Script param in dbg pester Use same Pester output format that tasks use for user familiarity * Remove unnecessary string interpolation.
I'm experiencing similar issues. When clicking on Another thing of note can be that starting with Pester version 5 it is possible to use the |
This issue is fixed in master... Just pending a new release |
Thank you @TylerLeonhardt , we're currently using the insiders version. So we'll see it come in when it's ready. Thanks again for your help.
|
System Details
Operating system name and version:
Windows 10 Enterprise
Version 1709 (OS Build 16299.611)
VS Code version:
Version: 1.26.1
Commit: 493869ee8e8a846b0855873886fc79d480d342de
Date: 2018-08-16T18:38:57.434Z
Electron: 2.0.5
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
PowerShell extension version: 1.8.3
Issue Description
I am experiencing a problem with...
In Powershell Pester test scripts, both "Run tests" and "Debug tests" (above a Pester Describe block) give an error:
Running the contributed command:'PowerShell.RunPesterTests' failed.
Test script:
Attached Logs
Follow the instructions in the README
about capturing and sending logs.
EditorServices.log
vscode-powershell.log
The text was updated successfully, but these errors were encountered: