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

This commit is contained in:
Aditya Patwardhan
2023-04-07 12:02:10 -07:00
committed by Dongbo Wang
parent 0c52638dad
commit 980b16561c
3 changed files with 21 additions and 0 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
@@ -2,6 +2,15 @@
# Licensed under the MIT License.
Describe 'OutputRendering tests' -Tag 'CI' {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
# Console host does not support VT100 escape sequences on Windows 2012R2 or earlier
if (-not $host.ui.SupportsVirtualTerminal) {
$global:PSDefaultParameterValues["it:skip"] = $true
}
}
BeforeEach {
if ($null -ne $PSStyle) {
$oldOutputRendering = $PSStyle.OutputRendering