From 2b690c0dd83ab6e63ed9c8235d5404839037d340 Mon Sep 17 00:00:00 2001 From: Frode Flaten <3436158+fflaten@users.noreply.github.com> Date: Sun, 4 Aug 2024 15:11:46 +0000 Subject: [PATCH] Sort files in Coverage --- src/functions/Coverage.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/functions/Coverage.ps1 b/src/functions/Coverage.ps1 index aadbdfa55..22e2a2e39 100644 --- a/src/functions/Coverage.ps1 +++ b/src/functions/Coverage.ps1 @@ -249,7 +249,8 @@ function Get-CoverageBreakpoints { [ScriptBlock]$Logger ) - $fileGroups = @($CoverageInfo | & $SafeCommands['Group-Object'] -Property Path) + # PowerShell 6.1+ sorts during Group-Object. Sorting to get equal report order for Windows PowerShell and PowerShell + $fileGroups = @($CoverageInfo | & $SafeCommands['Group-Object'] -Property Path | & $SafeCommands['Sort-Object'] -Property Name) foreach ($fileGroup in $fileGroups) { if ($null -ne $Logger) { $sw = [System.Diagnostics.Stopwatch]::StartNew()