reduce output of pester for CI (#4855)
This commit is contained in:
parent
7c8b7eff52
commit
9791116979
78
build.psm1
78
build.psm1
|
@ -824,6 +824,7 @@ function Start-PSPester {
|
|||
[Parameter(ParameterSetName='Unelevate',Mandatory=$true)]
|
||||
[switch]$Unelevate,
|
||||
[switch]$Quiet,
|
||||
[switch]$Terse,
|
||||
[Parameter(ParameterSetName='PassThru',Mandatory=$true)]
|
||||
[switch]$PassThru,
|
||||
[switch]$IncludeFailingTest
|
||||
|
@ -865,6 +866,10 @@ function Start-PSPester {
|
|||
|
||||
# All concatenated commands/arguments are suffixed with the delimiter (space)
|
||||
$Command = ""
|
||||
if ($Terse)
|
||||
{
|
||||
$Command += "`$ProgressPreference = 'silentlyContinue'; "
|
||||
}
|
||||
|
||||
# Autoload (in subprocess) temporary modules used in our tests
|
||||
$Command += '$env:PSModulePath = '+"'$TestModulePath$TestModulePathSeparator'" + '+$($env:PSModulePath);'
|
||||
|
@ -907,6 +912,49 @@ function Start-PSPester {
|
|||
|
||||
Write-Verbose $Command
|
||||
|
||||
$script:nonewline = $true
|
||||
$script:inerror = $false
|
||||
function Write-Terse([string] $line)
|
||||
{
|
||||
$trimmedline = $line.Trim()
|
||||
if ($trimmedline.StartsWith("[+]")) {
|
||||
Write-Host "+" -NoNewline -ForegroundColor Green
|
||||
$script:nonewline = $true
|
||||
$script:inerror = $false
|
||||
}
|
||||
elseif ($trimmedline.StartsWith("[?]")) {
|
||||
Write-Host "?" -NoNewline -ForegroundColor Cyan
|
||||
$script:nonewline = $true
|
||||
$script:inerror = $false
|
||||
}
|
||||
elseif ($trimmedline.StartsWith("[!]")) {
|
||||
Write-Host "!" -NoNewline -ForegroundColor Gray
|
||||
$script:nonewline = $true
|
||||
$script:inerror = $false
|
||||
}
|
||||
else {
|
||||
if ($script:nonewline) {
|
||||
Write-Host "`n" -NoNewline
|
||||
}
|
||||
if ($trimmedline.StartsWith("[-]") -or $script:inerror) {
|
||||
Write-Host $line -ForegroundColor Red
|
||||
$script:inerror = $true
|
||||
}
|
||||
elseif ($trimmedline.StartsWith("VERBOSE:")) {
|
||||
Write-Host $line -ForegroundColor Yellow
|
||||
$script:inerror = $false
|
||||
}
|
||||
elseif ($trimmedline.StartsWith("Describing") -or $trimmedline.StartsWith("Context")) {
|
||||
Write-Host $line -ForegroundColor Magenta
|
||||
$script:inerror = $false
|
||||
}
|
||||
else {
|
||||
Write-Host $line -ForegroundColor Gray
|
||||
}
|
||||
$script:nonewline = $false
|
||||
}
|
||||
}
|
||||
|
||||
# To ensure proper testing, the module path must not be inherited by the spawned process
|
||||
try {
|
||||
$originalModulePath = $env:PSModulePath
|
||||
|
@ -917,7 +965,17 @@ function Start-PSPester {
|
|||
while ($true)
|
||||
{
|
||||
$lines = Get-Content $outputBufferFilePath | Select-Object -Skip $currentLines
|
||||
$lines | Write-Host
|
||||
if ($Terse)
|
||||
{
|
||||
foreach ($line in $lines)
|
||||
{
|
||||
Write-Terse -line $line
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$lines | Write-Host
|
||||
}
|
||||
if ($lines | Where-Object { $_ -eq '__UNELEVATED_TESTS_THE_END__'})
|
||||
{
|
||||
break
|
||||
|
@ -942,7 +1000,14 @@ function Start-PSPester {
|
|||
try
|
||||
{
|
||||
$Command += "|Export-Clixml -Path '$passThruFile' -Force"
|
||||
Start-NativeExecution -sb {& $powershell -noprofile -c $Command} | ForEach-Object { Write-Host $_}
|
||||
if ($Terse)
|
||||
{
|
||||
Start-NativeExecution -sb {& $powershell -noprofile -c $Command} | ForEach-Object { Write-Terse $_}
|
||||
}
|
||||
else
|
||||
{
|
||||
Start-NativeExecution -sb {& $powershell -noprofile -c $Command} | ForEach-Object { Write-Host $_}
|
||||
}
|
||||
Import-Clixml -Path $passThruFile | Where-Object {$_.TotalCount -is [Int32]}
|
||||
}
|
||||
finally
|
||||
|
@ -952,7 +1017,14 @@ function Start-PSPester {
|
|||
}
|
||||
else
|
||||
{
|
||||
Start-NativeExecution -sb {& $powershell -noprofile -c $Command}
|
||||
if ($Terse)
|
||||
{
|
||||
Start-NativeExecution -sb {& $powershell -noprofile -c $Command} | ForEach-Object { Write-Terse -line $_ }
|
||||
}
|
||||
else
|
||||
{
|
||||
Start-NativeExecution -sb {& $powershell -noprofile -c $Command}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -348,11 +348,11 @@ function Invoke-AppVeyorTest
|
|||
Remove-Item -Force ${telemetrySemaphoreFilepath}
|
||||
}
|
||||
|
||||
Start-PSPester -bindir $env:CoreOutput -outputFile $testResultsNonAdminFile -Unelevate -Tag @() -ExcludeTag ($ExcludeTag + @('RequireAdminOnWindows'))
|
||||
Start-PSPester -Terse -bindir $env:CoreOutput -outputFile $testResultsNonAdminFile -Unelevate -Tag @() -ExcludeTag ($ExcludeTag + @('RequireAdminOnWindows'))
|
||||
Write-Host -Foreground Green 'Upload CoreCLR Non-Admin test results'
|
||||
Update-AppVeyorTestResults -resultsFile $testResultsNonAdminFile
|
||||
|
||||
Start-PSPester -bindir $env:CoreOutput -outputFile $testResultsAdminFile -Tag @('RequireAdminOnWindows') -ExcludeTag $ExcludeTag
|
||||
Start-PSPester -Terse -bindir $env:CoreOutput -outputFile $testResultsAdminFile -Tag @('RequireAdminOnWindows') -ExcludeTag $ExcludeTag
|
||||
Write-Host -Foreground Green 'Upload CoreCLR Admin test results'
|
||||
Update-AppVeyorTestResults -resultsFile $testResultsAdminFile
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ else
|
|||
$pesterParam = @{
|
||||
'binDir' = $output
|
||||
'PassThru' = $true
|
||||
'Terse' = $true
|
||||
}
|
||||
|
||||
if ($isFullBuild) {
|
||||
|
|
Loading…
Reference in a new issue