Skip to content

Run single test in Pester v5 #1167

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

Merged
merged 13 commits into from
Mar 12, 2020

Conversation

nohwnd
Copy link
Contributor

@nohwnd nohwnd commented Jan 27, 2020

This shows the lense on every Describe \ Context and It.

To test this you need Pester v5 ( branch filter-by-lines or once merged v5.0), you will also need the updated extension from vscode-powershell repo (branch same as here). Once your VSCode is started with the new version (after running the extension by F5), open a .Tests.ps1 file and load Pester v5.

Get-Module Pester | Remove-Module ; Import-Module Projects/Pester/Pester.psd1

WIP:
Once merged this will show the menu for all versions of Pester are we able to somehow figure out the version of Pester beforehand and only use the new approach when Pester v5 is loaded?

If not, should we add opt-in setting? Pester v5 is still far from ready, but I want to use this with beta which will be soon available 🙂

Ready:
Added opt-in setting for Pester5 that will enable the code lens for all items, otherwise it will use the standard Describe-only lense. This old lense works for both Pester v4 and v5, it just does not take full potential of v5. l used an option, instead of trying to detect which Pester version would be loaded because I don't want to guess, and I also want to force loading of Pester v5 when the code lense for it is specified. Using the existion VSCode configuration infrastructure this can be enabled per workspace.

@nohwnd nohwnd requested a review from rjmholt as a code owner January 27, 2020 19:22
@nohwnd nohwnd changed the title WIP: Run single test in Pester v5 Run single test in Pester v5 Feb 8, 2020
@nohwnd
Copy link
Contributor Author

nohwnd commented Feb 13, 2020

This should be now good to go. When can I expect it in PowerShell and PowerShell Preview extension?

@TylerLeonhardt
Copy link
Member

Since we're in a crunch time to ship PSReadLine in the PowerShell stable extension, this will not make that.

However, it will be in the next preview after that whi h will probably be a week or two after that goes out. So maybe by the end of the month.

@TylerLeonhardt TylerLeonhardt force-pushed the run-single-test-in-pester-v5 branch from 381eca1 to 1d949af Compare March 12, 2020 00:09
@TylerLeonhardt
Copy link
Member

This should be good now.

@TylerLeonhardt
Copy link
Member

gah need to fix a test now :)

@nohwnd
Copy link
Contributor Author

nohwnd commented Mar 12, 2020

:shipit:

@TylerLeonhardt
Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- src/PowerShellEditorServices/Services/CodeLens/PesterCodeLensProvider.cs  1
         

Clones added
============
- test/PowerShellEditorServices.Test.E2E/LanguageServerProtocolMessageTests.cs  14
         

See the complete overview on Codacy

@TylerLeonhardt
Copy link
Member

I've changed the verb to use to be consistent with the useLegacyReadLine setting.

@TylerLeonhardt TylerLeonhardt merged commit 612200d into PowerShell:master Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants