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

This commit is contained in:
Aditya Patwardhan
2023-04-07 11:47:34 -07:00
committed by Dongbo Wang
parent 9fc8642474
commit 8450602d59
3 changed files with 22 additions and 1 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
}
@@ -127,6 +127,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
@@ -1,7 +1,16 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe 'OutputRendering tests' {
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