Skip VT100 tests on Windows Server 2012R2 as console does not support it (#19413)

This commit is contained in:
Aditya Patwardhan
2023-03-27 17:36:41 -07:00
committed by GitHub
parent 7ee22063c5
commit 5a22587792
3 changed files with 15 additions and 2 deletions
@@ -3,12 +3,19 @@
Describe '$env:__SuppressAnsiEscapeSequences tests' -Tag CI {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
if (-not $host.ui.SupportsVirtualTerminal) {
$global:PSDefaultParameterValues["it:skip"] = $true
}
$originalSuppressPref = $env:__SuppressAnsiEscapeSequences
$originalRendering = $PSStyle.OutputRendering
$PSStyle.OutputRendering = 'Ansi'
}
AfterAll {
$global:PSDefaultParameterValues = $originalDefaultParameterValues
$env:__SuppressAnsiEscapeSequences = $originalSuppressPref
$PSStyle.OutputRendering = $originalRendering
}
@@ -119,6 +119,11 @@ Describe 'Get-Error tests' -Tag CI {
}
It 'Get-Error uses Error color for Message and PositionMessage members' {
if (-not $host.ui.SupportsVirtualTerminal) {
Set-ItResult -Skipped -Because 'Windows Server 2012 R2 does not support VT100 escape sequences'
}
$suppressVT = $false
if (Test-Path env:/__SuppressAnsiEscapeSequences) {
$suppressVT = $true
@@ -5,8 +5,9 @@ Describe 'OutputRendering tests' -Tag 'CI' {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
# Console host does not support VT100 escape sequences on Windows 2012R2 or earlier
if ($IsWindows -and [System.Environment]::OSVersion.Version -le [version]::new(6, 3)) {
$PSDefaultParameterValues["it:skip"] = $true
if (-not $host.ui.SupportsVirtualTerminal) {
$global:PSDefaultParameterValues["it:skip"] = $true
}
}