This repository was archived by the owner on Jun 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Modules/OperationValidation Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,19 @@ function Get-TestFromScript
89
89
}, $true ) |
90
90
ForEach-Object {
91
91
# This is the name of the 'describe' block
92
- $describeName = ($_.CommandElements | Where-Object { $_.StaticType.name -eq ' string' })[1 ].SafeGetValue()
93
-
92
+ for ($x = 0 ; $x -lt $_.CommandElements.Count ; $x ++ )
93
+ {
94
+ # Name parameter is named
95
+ if ($_.CommandElements [$x ] -is [System.Management.Automation.Language.CommandParameterAst ] -and $_.CommandElements [$x ].ParameterName -eq ' Name' )
96
+ {
97
+ $describeName = $_.CommandElements [$x + 1 ].value
98
+ }
99
+ # if we have a string without a parameter name, return first hit. Name parameter is at position 0.
100
+ ElseIf (($_.CommandElements [$x ] -is [System.Management.Automation.Language.StringConstantExpressionAst ]) -and ($_.CommandElements [$x - 1 ] -is [System.Management.Automation.Language.StringConstantExpressionAst ]))
101
+ {
102
+ $describeName = $_.CommandElements [$x ].value
103
+ }
104
+ }
94
105
$item = [PSCustomObject ][ordered ]@ {
95
106
Name = $describeName
96
107
Tags = @ ()
You can’t perform that action at this time.
0 commit comments