Skip to content

Commit

Permalink
Extend sort to all Group-Object
Browse files Browse the repository at this point in the history
Saving future headaches
  • Loading branch information
fflaten committed Aug 4, 2024
1 parent 2b690c0 commit 93c73fb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/functions/Coverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function Get-CoverageBreakpoints {
[ScriptBlock]$Logger
)

# PowerShell 6.1+ sorts during Group-Object. Sorting to get equal report order for Windows PowerShell and PowerShell
# PowerShell 6.1+ sorts by default in Group-Object. We need to sort for consistent output in Windows PowerShell
$fileGroups = @($CoverageInfo | & $SafeCommands['Group-Object'] -Property Path | & $SafeCommands['Sort-Object'] -Property Name)
foreach ($fileGroup in $fileGroups) {
if ($null -ne $Logger) {
Expand Down Expand Up @@ -820,9 +820,10 @@ function Get-JaCoCoReportXml {
[long] $endTime = [math]::Floor((New-TimeSpan -start $nineteenSeventy -end $now).TotalMilliseconds)
[long] $startTime = [math]::Floor($endTime - $TotalMilliseconds)

# PowerShell 6.1+ sorts by default in Group-Object. We need to sort for consistent output in Windows PowerShell
$folderGroups = $CommandCoverage | & $SafeCommands["Group-Object"] -Property {
& $SafeCommands["Split-Path"] $_.File -Parent
}
} | & $SafeCommands["Sort-Object"] -Property Name

$packageList = [System.Collections.Generic.List[psobject]]@()

Expand Down
1 change: 1 addition & 0 deletions src/functions/TestResults.NUnit25.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function Write-NUnitTestSuiteElements {

$suites = @(
# Tests only have GroupId if parameterized. All other tests are put in group with '' value
# PowerShell 6.1+ sorts by default in Group-Object. We need to sort for consistent output in Windows PowerShell
$Node.Tests | & $SafeCommands['Group-Object'] -Property GroupId
)

Expand Down
1 change: 1 addition & 0 deletions src/functions/TestResults.NUnit3.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function Write-NUnit3TestSuiteElement {

$blockGroups = @(
# Blocks only have GroupId if parameterized (using -ForEach). All other blocks are put in group with '' value
# PowerShell 6.1+ sorts by default in Group-Object. We need to sort for consistent output in Windows PowerShell
$Node.Blocks | & $SafeCommands['Group-Object'] -Property GroupId
)

Expand Down

0 comments on commit 93c73fb

Please sign in to comment.