Closed asears closed 4 years ago
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?
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.
I don't think Should has ever needed a "-" Should is a Powershell command so it doesn't need one.
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.
Closing for #1634
1. General summary of the issue
This is a minor detail which might help with upgrade path.
Message
Is not intuitive. eg.
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