-
-
Notifications
You must be signed in to change notification settings - Fork 467
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
Refactor Invoke-Pester and validate configuration early #2317
Changes from 17 commits
0dace9e
83f60b8
39654cc
c5a337f
e67fc35
4f66c73
efd43a8
1180b5f
fc8ff72
e97a607
16b5230
99b955f
773bcf3
b47c600
4a01048
21aceb8
7520096
0ca5d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1182,6 +1182,17 @@ function Run-Test { | |
|
||
$result | ||
} | ||
|
||
$steps = $state.Plugin.RunEnd | ||
if ($null -ne $steps -and 0 -lt @($steps).Count) { | ||
Invoke-PluginStep -Plugins $state.Plugin -Step RunEnd -Context @{ | ||
Blocks = $Block | ||
Configuration = $state.PluginConfiguration | ||
Data = $state.PluginData | ||
WriteDebugMessages = $PesterPreference.Debug.WriteDebugMessages.Value | ||
Write_PesterDebugMessage = if ($PesterPreference.Debug.WriteDebugMessages.Value) { $script:SafeCommands['Write-PesterDebugMessage'] } | ||
} -ThrowOnFailure | ||
} | ||
} | ||
|
||
function Invoke-PluginStep { | ||
|
@@ -1292,21 +1303,20 @@ function Assert-Success { | |
$anyFailed = $false | ||
$err = "" | ||
foreach ($r in $InvocationResult) { | ||
$rc++ | ||
$ec = 0 | ||
if ($null -ne $r.ErrorRecord -and $r.ErrorRecord.Length -gt 0) { | ||
$err += "Result $($rc++):" | ||
$anyFailed = $true | ||
foreach ($e in $r.ErrorRecord) { | ||
$err += "Error $($ec++):" | ||
$err += "$([Environment]::NewLine)Result $rc - Error $((++$ec)):" | ||
$err += & $SafeCommands["Out-String"] -InputObject $e | ||
$err += & $SafeCommands["Out-String"] -InputObject $e.ScriptStackTrace | ||
} | ||
} | ||
} | ||
|
||
if ($anyFailed) { | ||
$Message = $Message + ":`n$err" | ||
Write-PesterHostMessage -ForegroundColor Red $Message | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this or good? Not validating configuration in plugin-step now, so PR is not affected by the duplicate error from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good. |
||
$Message = $Message + ":$err" | ||
throw $Message | ||
} | ||
} | ||
|
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.
Previous message didn't print
$ec
and$rc
(only incremented them) due to missing parantheses.