Skip to content
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

Run single Pester test #2441

Merged
merged 4 commits into from
Mar 12, 2020

Conversation

nohwnd
Copy link
Contributor

@nohwnd nohwnd commented Jan 27, 2020

PR Summary

Add support for Pester v5 to run single test, all tests in any describe or all tests in via the task.

The VSCodeMarker is not provided. The Pester side would work, but the highlighting (or what was it for) does not work in VSCode, and so it only makes the output uglier, with stacktrace on the top.

To test this you need Pester v5 ( branch filter-by-lines or once merged v5.0), you will also need the updated lense from powershell services (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

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests NA
  • This PR is ready to merge and is not work in progress
    This is be safe to merge, the new behavior is version checked.

@nohwnd nohwnd requested a review from TylerLeonhardt January 27, 2020 19:11
@TylerLeonhardt
Copy link
Member

This looks good to me, when are you targeting Pester 5 to come out?

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

👍

@nohwnd
Copy link
Contributor Author

nohwnd commented Feb 8, 2020

The previous commit was broken it actually run all the files in the current path.
I added opt-in option for v5 lens, so people can enable it when they are ready to give Pester v5 a try, and don't have to be confused by having Run Test on their It blocks that does not actually run.

I hope that it is okay to put the settings on language server settings object, because that is where the majority of other settings are, and it required least amount of changes to the code.

While I was at it I also added output option for verbosity. All the settings work for both v4 and v5 and were tested with the other PR in powershell editor services. The expected behavior is:

  • Nothing will change with the default settings.
  • User can change verbosity to print everything (failed, describe descritions, summary etc.) except for Passed tests, by setting the Minimal verbosity on v4.
  • User can run Pester v5 tests without enabling the opt-in option, but will only be able to run whole describes.
  • User can enable the code lens, and run any block and any test. This requires pester v5 if no Pester is loaded, and warns if older version is loaded.
  • User can set verbosity to minimal, and see just failed tests + summary.

If this gets merged when can I expect it in PowerShell preview extension? It would be nice to have so I can use it without running VSCode in VSCode. I think I will also soon release v5-beta. Released.

package.json Outdated Show resolved Hide resolved
@TylerLeonhardt
Copy link
Member

I need to move this file into PSES repo so it can be signed. If you'd like to sign up to do that, that'd be great, otherwise, hopefully we can get this PR in soon so I can move it.

@nohwnd
Copy link
Contributor Author

nohwnd commented Mar 11, 2020

Okay, will finish this today. :)

@TylerLeonhardt TylerLeonhardt merged commit 9051b99 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