Skip to content

Commit 17372ea

Browse files
refactor: remove IsWindows compatibility shim test
The $IsWindows PS 5.1 shim is being removed from Build-PSModule since PSModule targets PowerShell LTS (7.6+). Remove the corresponding test context and update the test repo output fixture.
1 parent 3f45838 commit 17372ea

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

src/tests/Module/PSModule/PSModule.Tests.ps1

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,6 @@ Describe 'PSModule - Module tests' {
8989
}
9090
}
9191

92-
Context 'Framework - IsWindows compatibility shim' {
93-
BeforeAll {
94-
Import-Module -Name $moduleManifestPath -Force
95-
$script:moduleRef = Get-Module -Name $moduleName
96-
}
97-
It 'Should have $IsWindows defined in the module scope' {
98-
# The framework injects "$IsWindows = $true" for PowerShell 5.1 (Desktop edition).
99-
# On PS 7+ (Core), $IsWindows is a built-in automatic variable.
100-
# The variable is set inside the module scope and is not exported, so we must check from within the module.
101-
$isWindowsDefined = & $script:moduleRef { Get-Variable -Name 'IsWindows' -ErrorAction SilentlyContinue }
102-
$isWindowsDefined | Should -Not -BeNullOrEmpty -Because 'the framework injects a compatibility shim for PS 5.1'
103-
}
104-
}
105-
10692
Context 'Framework - Type accelerator registration' -Skip:(-not $hasClassExporter) {
10793
BeforeAll {
10894
Import-Module -Name $moduleManifestPath -Force

tests/outputTestRepo/outputs/module/PSModuleTest/PSModuleTest.psm1

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains long links.')]
2-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
3-
'PSAvoidAssignmentToAutomaticVariable', 'IsWindows',
4-
Justification = 'IsWindows does not exist in PS5.1'
5-
)]
6-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
7-
'PSUseDeclaredVarsMoreThanAssignments', 'IsWindows',
8-
Justification = 'IsWindows does not exist in PS5.1'
9-
)]
102
[CmdletBinding()]
113
param()
124

135
$scriptName = $MyInvocation.MyCommand.Name
146
Write-Debug "[$scriptName] Importing module"
157

16-
#region - IsWindows compatibility shim
17-
if ($PSEdition -eq 'Desktop') {
18-
$IsWindows = $true
19-
}
20-
#endregion - IsWindows compatibility shim
21-
228
#region - Data import
239
Write-Debug "[$scriptName] - [data] - Processing folder"
2410
$dataFolder = (Join-Path $PSScriptRoot 'data')

0 commit comments

Comments
 (0)