Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/Invoke-Pester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,18 @@ $summary = @"
| Total | $($result.TotalCount) |
| Passed | $($result.PassedCount) |
| Failed | $($result.FailedCount) |
| Failed Blocks | $($result.FailedBlocksCount) |
| Failed Containers | $($result.FailedContainersCount) |
Comment on lines +97 to +98

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency (non-blocking)relates to test-summary.json generation just above this hunk (lines 78-79).

The markdown table now surfaces FailedBlocksCount / FailedContainersCount, but the persisted test-summary.json still selects only FailedCount, so the uploaded artifact disagrees with this table and the gate. Consider adding the two new counters there as well:

$result | Select-Object TotalCount, PassedCount, FailedCount, FailedBlocksCount, FailedContainersCount, SkippedCount, Duration |
    ConvertTo-Json | Set-Content (Join-Path $OutputPath 'test-summary.json')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls repost the suggestions as actual suggestions and not just code blocks so they can be applied.

| Skipped | $($result.SkippedCount) |
| Duration | $($result.Duration) |
"@

Write-CIStepSummary $summary

Set-CIOutput -Name 'test-result' -Value $(if ($result.FailedCount -eq 0) { 'passed' } else { 'failed' })
Set-CIOutput -Name 'test-result' -Value $(if (($result.FailedCount + $result.FailedBlocksCount + $result.FailedContainersCount) -eq 0) { 'passed' } else { 'failed' })
Set-CIOutput -Name 'test-count' -Value $result.TotalCount.ToString()
Set-CIOutput -Name 'fail-count' -Value $result.FailedCount.ToString()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency (non-blocking): fail-count still reports only FailedCount. With the new gate above, a run can now emit test-result = 'failed' while fail-count = 0, which is contradictory for any consumer of these outputs. Suggest summing all three counters (or reporting them separately):

Set-CIOutput -Name 'fail-count' -Value (($result.FailedCount + $result.FailedBlocksCount + $result.FailedContainersCount)).ToString()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls repost the suggestions as actual suggestions and not just code blocks so they can be applied.

@rezatnoMsirhC rezatnoMsirhC Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

Suggested change
Set-CIOutput -Name 'fail-count' -Value $result.FailedCount.ToString()
Set-CIOutput -Name 'fail-count' -Value (($result.FailedCount + $result.FailedBlocksCount + $result.FailedContainersCount)).ToString()

@katriendg @WilliamBerryiii @bindsi @agreaves-ms Have we considered suggestion blocks instead of code-blocks where applicable for the PR Review and/or Code Review agents?


if ($CI -and $result.FailedCount -gt 0) {
if ($CI -and ($result.FailedCount + $result.FailedBlocksCount + $result.FailedContainersCount) -gt 0) {
exit 1
Comment on lines +109 to 110

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reliability / developer UX (non-blocking)relates to Get-FailedTest and the annotation loop above (lines 52-71, 83-86).

Now that the build fails on block/container failures, there's a gap: Get-FailedTest only walks It results, so a failure that trips this new exit 1 (a throwing BeforeAll/AfterAll, or a container that fails discovery/load) produces no Write-CIAnnotation — the developer sees a red build with only the summary counts and no inline pointer to the cause. Consider annotating failed containers so the new failure modes are actionable, e.g.:

foreach ($container in $result.Containers) {
    if ($container.Result -eq 'Failed') {
        Write-CIAnnotation -Level 'Error' `
            -Message "Container failed to run: $($container.Item)$($container.ErrorRecord.Exception.Message)" `
            -File $container.Item
    }
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls repost the suggestions as actual suggestions and not just code blocks so they can be applied.

}
Loading