Skip to content
Draft
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
23 changes: 15 additions & 8 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ function Start-PSBuild {
"linux-arm",
"linux-arm64",
"linux-x64",
"linux-loongarch64",
"linux-musl-loongarch64",
"osx-arm64",
"osx-x64",
"win-arm",
Expand Down Expand Up @@ -1025,6 +1027,8 @@ function New-PSOptions {
"linux-arm",
"linux-arm64",
"linux-x64",
"linux-loongarch64",
"linux-musl-loongarch64",
"osx-arm64",
"osx-x64",
"win-arm",
Expand Down Expand Up @@ -1879,51 +1883,51 @@ function Get-PesterFailureFileInfo
# "at <ScriptBlock>, C:\path\to\file.ps1: line 123"
# "at 1 | Should -Be 2, /path/to/file.ps1:123" (Pester 5)
# "at 1 | Should -Be 2, C:\path\to\file.ps1:123" (Pester 5 Windows)

$result = @{
File = $null
Line = $null
}

if ([string]::IsNullOrWhiteSpace($StackTraceString)) {
return $result
}

# Try pattern: "at line: 123 in <path>" (Pester 4)
if ($StackTraceString -match 'at line:\s*(\d+)\s+in\s+(.+?)(?:\r|\n|$)') {
$result.Line = $matches[1]
$result.File = $matches[2].Trim()
return $result
}

# Try pattern: ", <path>:123" (Pester 5 format)
# This handles both Unix paths (/path/file.ps1:123) and Windows paths (C:\path\file.ps1:123)
if ($StackTraceString -match ',\s*((?:[A-Za-z]:)?[\/\\].+?\.ps[m]?1):(\d+)') {
$result.File = $matches[1].Trim()
$result.Line = $matches[2]
return $result
}

# Try pattern: "at <path>:123" (without comma)
# Handle both absolute Unix and Windows paths
if ($StackTraceString -match 'at\s+((?:[A-Za-z]:)?[\/\\][^,]+?\.ps[m]?1):(\d+)(?:\r|\n|$)') {
$result.File = $matches[1].Trim()
$result.Line = $matches[2]
return $result
}

# Try pattern: "<path>: line 123"
if ($StackTraceString -match '((?:[A-Za-z]:)?[\/\\][^,]+?\.ps[m]?1):\s*line\s+(\d+)(?:\r|\n|$)') {
$result.File = $matches[1].Trim()
$result.Line = $matches[2]
return $result
}

# Try to extract just the file path if no line number found
if ($StackTraceString -match '(?:at\s+|in\s+)?((?:[A-Za-z]:)?[\/\\].+?\.ps[m]?1)') {
$result.File = $matches[1].Trim()
}

return $result
}

Expand Down Expand Up @@ -3985,6 +3989,9 @@ function Clear-NativeDependencies
'.*-arm64' {
$diasymFileName = $diasymFileNamePattern -f 'arm64'
}
'.*-loongarch64' {
$diasymFileName = $diasymFileNamePattern -f 'loongarch64'
}
'fxdependent.*' {
Write-Verbose -Message "$($script:Options.Runtime) is a fxdependent runtime, no cleanup needed in pwsh.deps.json" -Verbose
return
Expand Down