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
8989 }, $true ) |
9090 ForEach-Object {
9191 # 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+ }
94105 $item = [PSCustomObject ][ordered ]@ {
95106 Name = $describeName
96107 Tags = @ ()
You can’t perform that action at this time.
0 commit comments