Skip to content
Merged
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
8 changes: 7 additions & 1 deletion build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,13 @@ function Publish-TestResults
$_ -replace 'result="Ignored"', 'result="Skipped"'
} | Out-File -FilePath $tempFilePath -Encoding ascii -Force

Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$tempFilePath;]"
# If we attempt to upload a result file which has no test cases in it, then vsts will produce a warning
# so check to be sure we actually have a result file that contains test cases to upload.
# If the the "test-case" count is greater than 0, then we have results.
# Regardless, we want to upload this as an artifact, so this logic doesn't pertain to that.
if ( @(([xml](Get-Content $Path)).SelectNodes(".//test-case")).Count -gt 0 -or $Type -eq 'XUnit' ) {
Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$tempFilePath;]"
}

$resolvedPath = (Resolve-Path -Path $Path).ProviderPath
Write-Host "##vso[artifact.upload containerfolder=testResults;artifactname=testResults]$resolvedPath"
Expand Down