pester/vscode-adapter

"Run Tests" miscounts, gets stuck "running", though "Show Output" shows "Complete".

ziesemer opened this issue · 10 comments

Testing against https://github.com/ziesemer/ad-privileged-audit/tree/b0444d6484f7e7b50c67831ab3ddb65802c5ff6d for this report.

The VSC UI is stuck on:
image
in the "Testing" pane and
image
in the status bar.

Clicking on "Show Output" to display the "Test Output" starts with:

Starting discovery in 3 files.
Discovery found 60 tests in 70ms.
Running tests.

... and finishes with:

[+] ***\ad-privileged-audit\Tests\AD-Privileged-Audit.Tests.ps1
 4s (3.31s|650ms)
[+] ***\ad-privileged-audit\Tests\Write-Log.Tests.ps1
 65ms (30ms|29ms)
[+] ***\ad-privileged-audit\Tests\DistinguishedNameParser.Tests.ps1
 259ms (96ms|156ms)
Tests completed in 4.36s
Tests Passed: 60,
Failed: 0,
Skipped: 0

NotRun: 0

After then clicking "Cancel Test Run", the "Testing" UI updates to:
image
... and the "Test Output" further appends:
> Test run finished at 3/23/2022, 9:44:43 AM <

The adapter seems to be getting confused in the count of tests, as I never see the 75 number outside of use of the adapter. Furthermore, the difference of 15 (75-60) seems to be the number of branch nodes in the discovered tree - accounting for the number of "Describe" and "Context" blocks, as well as for each additional test file other than the first.

Pester Tests version:

Name: Pester Tests
Id: pspester.pester-test
Description: Enables you to run PowerShell Pester tests using the VSCode testing feature
Version: 2022.2.0
Publisher: Pester
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=pspester.pester-test

VSC version: 1.65.2.

Thanks for the report! Yes there are some issues with the way runs are handled and pre-empted that can cause it to be stuck and sometimes duplicate testItem entries when they are edited and moved. A "reload window" should sort this out, and I plan to implement the new refresh button UI (#102) to do something similar without having to reload the new window.

To the best of my findings, I currently have no way to resolve this. Neither a "Refresh Tests" nor an entire reload of VSC resolve this. In fact, even once I cancel the test run and get it back to the expected 60, re-running the tests bring it back to the incorrect 75.

I don't see this being a refresh issue - but that the initial tests are being miscounted.

I have two test files, each with a single describe. The file and describe become a yellow clock icon and never successful. Not having luck with anything either. Strangely running the file as Debug from the testing panel will show all green 🤯

I have two test files, each with a single describe. The file and describe become a yellow clock icon and never successful. Not having luck with anything either. Strangely running the file as Debug from the testing panel will show all green 🤯

The same for me, but I hadn't thought of doing it in Debug mode, and that works great - thanks for the tip!

When not running in Debug mode, the status of the "leaf nodes" (individual tests) doesn't get propagated up to their parents (the Describes, Contexts and files): those parents stay in "yellow clock" status forever. That doesn't seem to be affected by refreshing the tests, restarting VSC or even rebooting the machine.

I'm experiencing this as well on the latest version of VSCode (1.73.1) and the Pester (v2022.3.3, Pester v5.3.1) and Powershell plugins (v2022.11.10, Powershell version 7.3.0). I can also corroborate that running the tests in debug mode does not present this behaviour.

Hey thanks all for noting, I know it's a long standing problem but it requires a difficult refactoring of how events are streamed and collected from the Pester module to fix and my focus is on ModuleFast at the moment. I'll label it "help wanted" but it has a high difficulty bar to clear (you need expert knowledge of Typescript, node.js streams, named pipes, and intimate Powershell and Pester details)

Once I get ModuleFast to a decent state, coming back to this extension and making it better is next on my free time list.