From e04448df9ece585b7d02fe96f5ded344d6d257e2 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Thu, 29 May 2025 16:39:53 -0700 Subject: [PATCH 1/2] =?UTF-8?q?feat(Get-PreviewPanel):=20=F0=9F=8E=A8=20ad?= =?UTF-8?q?d=20breakdown=20chart=20for=20Pester=20object=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented a breakdown chart displaying the counts of Passed, Failed, Inconclusive, and Skipped tests. * Added a check to skip chart generation if the object is null or has all zero counts. * Remove breakdown from title. It was too messy. --- PesterExplorer/Private/Get-PreviewPanel.ps1 | 19 +++++++++++++++++++ PesterExplorer/Private/Get-TitlePanel.ps1 | 8 -------- 2 files changed, 19 insertions(+), 8 deletions(-) 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 | From 2e66f0961baf43429604544bf4d0ccf7c7c19015 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Thu, 29 May 2025 16:40:36 -0700 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E2=9C=8F=EF=B8=8F=20update=20CHAN?= =?UTF-8?q?GELOG=20for=20upcoming=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move test result breakdown chart to Preview pane. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) 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