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

should : Legacy Should syntax (without dashes) is not supported in Pester 5 #1590

Closed
asears opened this issue Jun 2, 2020 · 5 comments
Closed
Milestone

Comments

@asears
Copy link
Contributor

asears commented Jun 2, 2020

1. General summary of the issue

This is a minor detail which might help with upgrade path.

Message

should : Legacy Should syntax (without dashes) is not supported in Pester 5. Please refer to migration guide at: https://pester.dev/docs/migrations/v3-to-v4

Is not intuitive.
eg.

Should -Be 

works.

Is Should supported without dashes and -Be is not?

2. Describe Your Environment

Pester 5.0.1

3. Expected Behavior

Further details/clarity on change or utility to autofix/upgrade script via Pester.

4.Current Behavior

Link to upgrade document.

5. Possible Solution

Error message could be rephrased as Should is supported without dashes, the Be is not.
Would be great if there was autofix for this and details in the error of line contents containing the invalid syntax.

Is this linted/scanned in VSCode?

6. Context

@nohwnd
Copy link
Member

nohwnd commented Jun 2, 2020

I am not sure what you are saying. Should -Be is supposed to work, it has dash. Should Be, is not supposed to work, it does not have dash. 🙂

How can the message be improved?

@nohwnd nohwnd added this to the 5.0.x milestone Jun 2, 2020
@asears
Copy link
Contributor Author

asears commented Jun 3, 2020

Legacy Should syntax (without dashes) appears to suggest -Should have a dash. Could be useful if the error message suggested a correction in addition to linking to a URL. Could be just me!

Suggested error.

Syntax Error: Should command. Legacy Should syntax without dashes in operators following Should is no longer supported in Pester 5+.  Prefix operators following Should with dash, eg. "Should -Be".  Reference migration guide at https://pester.dev/docs/migrations/v3-to-v4 or run Get-Help -Name about_Pester_Should

My first instinct with current phrasing was to add hyphen to -Should when it is the -Be (or any operator following should) that needs to be fixed. The details of the error could provide an offline experience to get help on the mitigation of error.

@markgar
Copy link

markgar commented Jun 3, 2020

I don't think Should has ever needed a "-" Should is a Powershell command so it doesn't need one.

@asears
Copy link
Contributor Author

asears commented Jun 29, 2020

Perhaps this issue should -be focused more on documentation. Is there a separate issue for this? If so could probably close this issue?

 get-help should -examples

should return examples.

 get-help should -online

should point to https://pester.dev/docs/usage/assertions and not the wiki.

@asears
Copy link
Contributor Author

asears commented Aug 5, 2020

Closing for #1634

@asears asears closed this as completed Aug 5, 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

No branches or pull requests

3 participants