-
-
Notifications
You must be signed in to change notification settings - Fork 473
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
Include more statements in code coverage #2554
base: main
Are you sure you want to change the base?
Conversation
$predicate = { | ||
$args[0] -is [System.Management.Automation.Language.DynamicKeywordStatementAst] -or | ||
$args[0] -is [System.Management.Automation.Language.CommandBaseAst] | ||
$args[0] -is [System.Management.Automation.Language.CommandBaseAst] -or | ||
$args[0] -is [System.Management.Automation.Language.BreakStatementAst] -or | ||
$args[0] -is [System.Management.Automation.Language.ContinueStatementAst] -or | ||
$args[0] -is [System.Management.Automation.Language.ExitStatementAst] -or | ||
$args[0] -is [System.Management.Automation.Language.ThrowStatementAst] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only updated PSv5+ predicate as we might remove the redundant predicate for v6.
A potential backport would need to extend both predicates.
93c73fb
to
6286afa
Compare
@@ -110,6 +110,7 @@ function Write-NUnitTestSuiteElements { | |||
|
|||
$suites = @( | |||
# Tests only have GroupId if parameterized. All other tests are put in group with '' value | |||
# PowerShell 6.1+ sorts by default in Group-Object. We need to sort for consistent output in Windows PowerShell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This says we sort but the code below does not use sort? Is this a mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very likely. Good catch, will fix. :)
PR Summary
Extends code coverage to include
break
,continue
,exit
andthrow
statements.return
is not included due to inconsistent behavior (thoughreturn 123
is already covered as a command expression)Adds sort after
Group-Object
to save future headaches with inconsistent report/output order in Windows PowerShell vs PowerShell 6.1 which sorts by default.Fix #1465
PR Checklist
Create Pull Request
to mark it as a draft. PR can be markedReady for review
when it's ready.