Test discovery not finding PowerShell tests when opening folder
PoshTools 4.0.31, VS 15.8.7, PS 5.1.17134.407 Desktop
I'm assuming this is a bug rather than an intentional choice or VS limitation- sorry if I'm wrong!
When you open a folder in Visual Studio, Pester tests are not found by test discovery. The same files are found correctly when in a PowerShell project.
[08/12/2018 14:59:09 Diagnostic] No containers found from 'PowerShellTools.TestAdapter.PowerShellTestContainerDiscoverer' :
Having looked at the discovery code, I suspect the issue is in FindPowerShellTestFiles
, as it first checks project.IsPowerShellProject
, which I assume doesn't return true for a folder, and stops checking if it's not a PowerShell project. I think just removing that check would likely fix the issue? Checking for Pester tests in a non-PowerShell project doesn't seem like the worst thing in the world as I suppose it's possible to use it to test things that aren't PowerShell.
Test files are also not given the test file icon in solution explorer when a folder is opened, I assume for the same reason.