diff --git a/CHANGELOG.md b/CHANGELOG.md index 755c3fb..2a8a7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +- Move test result breakdown chart to Preview pane. + ## [0.2.0] 2025-05-28 ### Added diff --git a/PesterExplorer/Private/Get-PreviewPanel.ps1 b/PesterExplorer/Private/Get-PreviewPanel.ps1 index a8f9d33..bc8f53f 100644 --- a/PesterExplorer/Private/Get-PreviewPanel.ps1 +++ b/PesterExplorer/Private/Get-PreviewPanel.ps1 @@ -66,6 +66,25 @@ function Get-PreviewPanel { # SelectedItem can be a few different types: # - A Pester object (Run, Container, Block, Test) + #region Breakdown + # Skip if the object is null or they are all zero. + if ( + ( + $object.PassedCount + + $object.InconclusiveCount + + $object.SkippedCount + + $object.FailedCount + ) -gt 0 + ) { + $data = @() + $data += New-SpectreChartItem -Label "Passed" -Value ($object.PassedCount) -Color "Green" + $data += New-SpectreChartItem -Label "Failed" -Value ($object.FailedCount) -Color "Red" + $data += New-SpectreChartItem -Label "Inconclusive" -Value ($object.InconclusiveCount) -Color "Grey" + $data += New-SpectreChartItem -Label "Skipped" -Value ($object.SkippedCount) -Color "Yellow" + $result += Format-SpectreBreakdownChart -Data $data + } + #endregion Breakdown + # For Tests Let's print some more details if ($object.GetType().Name -eq "Test") { $formatSpectrePanelSplat = @{ diff --git a/PesterExplorer/Private/Get-TitlePanel.ps1 b/PesterExplorer/Private/Get-TitlePanel.ps1 index b855fa3..6a7b707 100644 --- a/PesterExplorer/Private/Get-TitlePanel.ps1 +++ b/PesterExplorer/Private/Get-TitlePanel.ps1 @@ -35,14 +35,6 @@ function Get-TitlePanel { $title += " | $($Item.GetType().Name): $($objectName)" } $rows += $title - #region Breakdown - $data = @() - $data += New-SpectreChartItem -Label "Passed" -Value ($Item.PassedCount) -Color "Green" - $data += New-SpectreChartItem -Label "Inconclusive" -Value ($Item.InconclusiveCount) -Color "Grey" - $data += New-SpectreChartItem -Label "Skipped" -Value ($Item.SkippedCount) -Color "Yellow" - $data += New-SpectreChartItem -Label "Failed" -Value ($Item.FailedCount) -Color "Red" - $rows += Format-SpectreBreakdownChart -Data $data -ShowPercentage - #endregion Breakdown return $rows | Format-SpectreRows | Format-SpectreAligned -HorizontalAlignment Center -VerticalAlignment Middle |