Open mkvideodj opened 3 years ago
@nohwnd any ideas on changes in 5.2 that might have broken me?
The scripts I run are here:
https://github.com/TylerLeonhardt/vscode-pester-test-adapter/blob/master/src/powershellScripts.ts
It hangs for me even with 5.1.1.
https://github.com/TylerLeonhardt/vscode-pester-test-adapter/blob/master/src/adapter.ts#L63 Here you have what looks like a correct set of tests in both 5.1.1 and 5.2.0. So probably issue with firing the event and receiving it by the test explorer?
Same problem here. Updated Pester from 5.0.4 (everything ok) to 5.2.0 -> test explorer doesn't show anything.
I, too, was experiencing the same issue after upgrading to Pester 5.2.0. I made some progress, though, to "fix" the Pester Test Explorer VS code plugin. I'm going to post my findings here so that others may weigh in on the changes before I (or anyone) submit a formal Pull Request.
The issue seems to be with the "Discovery Script", ~/.vscode/extensions/tylerleonhardt.vscode-pester-test-adapter-0.0.23/powershellScripts.js
, due to some of the improvements made in Pester 5.2.0.
Here are the modifications I made:
Reset-TestSuiteState
, as this function no longer appears necessary with Pester 5.2.0 due to the new session handling methods (New-PesterSession)..BlockContainer.
property from each of the $file
references, as there is no BlockContainer
property of $file
, which was resulting in NULL "suites" being added as children
to the root $testSuiteInfo
object. The resultant reference(s) now look like this: $file.Item.FullName
The only other change that I made which seemed to help, was updating the VS Code setting for pesterExplorer.testRootDirectory
to a single period (current directory) as this is the default for Pester. (See ([PesterConfiguration]::Default).Run.Path.Value
)
Before submitting a Pull Request, I think it would be best to also add some logic to determine the version of Pester and then execute Pester version dependent code (e.g. Reset-TestSuiteState
) based on said version. Either that or require Pester v5.2.0 for a future version(s) of the Pester Test Explorer VS code extension.
Ah I remember, this is using the internal hack I wrote some time ago for Tyler when he was starting this up. IIRC this was to enable running just discovery? That is built-in now in Pester 5.2.0, you just need .Run.SkipRun = $true, and via PassThru you will get the result object with all the tests.
I would like to try and push people to use 5.2 since this is an official API instead of the hacky script @nohwnd gave me :)
In this work we should notify the user that Pester 5.0 & 5.1 support will be removed in the future.
Thanks @nohwnd and @TylerLeonhardt , this helps provide the direction I need. I will take a 'stab' at updating the code and submitting a P.R.
If you have trouble, just let me know! Also if you can't figure out the notification part, that's ok. I can do it/provide my thoughts on that.
Hi. I tried to debug the extension, but couldn't see anything obvious - other than an error that Reset-TestSuiteState was not a recognised function. This was shown in the Pester Explorer log. When I reverted back to Pester 5.1.1, this error wasn't seen in the log. Debugging the extension I could see the promise for pesterTestRunner.loadPesterTests() being resolved - so maybe the exception is caught by the Test Explorer extension before it gets the load promise result.
The symptom is the Test Explorer in VSCode shows no tests - clicking on the Test Explorer: Reload tests icon results in the icon spinning forever.
I suspect you've been caught by a breaking change in pester. Some of my tests using modules fail in 5.2.0, so I'm happy to continue with 5.1.1 for now.
If I can provide any more details to assist you, let me know.
Thanks for this extension - attempting to debug it was my first exposure to VS Code extensions, so thanks for this experience and the instructions on your readme, even if I didn't actually manage to find the bug for you I learned how to step through a VS Code extension. :)
Thanks, Darryl