Skip to content

Conversation

@fflaten
Copy link
Contributor

@fflaten fflaten commented Feb 5, 2023

PR Summary

Adds support for using Run/Debug Tests codelens and Run/Debug Pester Tests commands with *.Koans.ps1-files used by PSKoans.

Manually testing only for InvokePesterStub.ps1 to avoid extra dependency for a simple feature.

PR Context

Fix PowerShell/vscode-powershell#4363

@fflaten fflaten requested a review from a team February 5, 2023 12:46
@fflaten fflaten requested a review from a team as a code owner February 5, 2023 12:46
@fflaten
Copy link
Contributor Author

fflaten commented Feb 5, 2023

Be aware that if a different Pester-version than the one used by PSKoans (currently 4.10.1) is already loaded, run/debug tests will fail during import. The same error occurs in a normal PowerShell-session, but mentioning it since we may get feedback here.

Importing PSKoans module...
Exception: /workspaces/vscode-powershell/modules/PowerShellEditorServices/InvokePesterStub.ps1:70:9
Line |
  70 |          $psKoansModule = Microsoft.PowerShell.Core\Import-Module PSKo …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Assertion operator name 'Be' has been added multiple times.
WARNING: Failed to import PSKoans. You must install PSKoans module to run or debug tests in *.Koans.ps1 files.

Should we add checks and print a better error or leave it for now? PSKoans is working on a Pester v5 -upgrade, but ETA is unclear.

@vexx32: Thoughts?

Code Lens feature only depend on Pester-symbols,
so only need to make sure they appear for *.koans.ps1 files
Copy link
Member

@andyleejordan andyleejordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great! What about you @SeeminglyScience?

@andyleejordan andyleejordan added Issue-Enhancement A feature request (enhancement). Area-Pester labels Feb 7, 2023
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@andyleejordan andyleejordan merged commit 9ee381f into PowerShell:main Feb 7, 2023
@fflaten fflaten deleted the pskoans branch February 7, 2023 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Pester Issue-Enhancement A feature request (enhancement).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSCode Pester support for PSKoans filenames

3 participants