Tag WinPE-incompatible Pester tests by jshigetomi · Pull Request #28177 · PowerShell/PowerShell · GitHub
Skip to content

Tag WinPE-incompatible Pester tests - #28177

Open
Justin Chung (jshigetomi) wants to merge 1 commit into
masterfrom
winpe-test-tagging
Open

Justin Chung (jshigetomi) wants to merge 1 commit into
masterfrom
winpe-test-tagging

Conversation

@jshigetomi

Copy link
Copy Markdown
Collaborator

PR Summary

Adds evidence-based NotWinPE tags to Pester tests that require capabilities intentionally absent from the base WinPE lane. Because the lane uses Pester 4.10.1, every tag is on an outermost Describe; mixed suites were split so compatible assertions remain enabled.

Against WinPE baseline build 726784, this excludes 137 of 402 failure records. Another 39 failures in the touched files remain enabled because they look like harness, product, or unclear environment behavior rather than unsupported WinPE capabilities.

The refactor also fixes two remote Copy-Item assertions so they inspect their actual Temp2 and Temp3 destinations instead of fixtures left by an earlier suite.

File Tagged scope Baseline failures WinPE capability / evidence
HostUtilities.Tests.ps1 Remote runspace 1 PowerShell remoting is unsupported
TabCompletion.Tests.ps1 CIM, DSC, WSMan, UNC/admin, Windows PowerShell, and remote-runspace suites 61 Native MI, DSC, WSMan/remoting, and desktop utilities are absent
Indexer.Tests.ps1 CIM class indexers 2 Native MI runtime is absent
NativeCommandArguments.Tests.ps1 Windows script-host cases 5 cscript.exe is absent
NativeCommandProcessor.Tests.ps1 Native utility pipeline and FAT VHD suites 2 Required native/Storage facilities are absent
OrderedAttributeForHashTables.Tests.ps1 New-CimInstance ordered properties 1 Native MI runtime is absent
CompatiblePSEditions.Module.Tests.ps1 Five WinCompat/Windows PowerShell suites 25 WinCompat remoting and Windows PowerShell are absent
Enter-PSHostProcess.Tests.ps1 Windows PowerShell host process 1 Windows PowerShell is absent
Get-PSHostProcessInfo.Tests.ps1 Windows PowerShell process discovery 1 Windows PowerShell is absent
Import-Module.Tests.ps1 PSScheduledJob/GAC suite 2 Windows PowerShell module/GAC dependency is absent
Job.Tests.ps1 Start-Job -PSVersion 5.1 1 Windows PowerShell 5.1 is absent
Copy-Item.Tests.ps1 Four remote-copy suites 4 PowerShell remoting is unsupported
FileSystem.Tests.ps1 runas.exe access and cross-drive move suites 2 Desktop utility and Storage/native MI dependencies are absent
Get-ChildItem.Tests.ps1 Windows volume paths 1 Get-Volume/Storage support is absent
Get-Service.Tests.ps1 Service security descriptor 1 sc.exe is absent
Set-Service.Tests.ps1 Service mutation/security suite 14 Required service-control/security facilities are unavailable
Start-Process.Tests.ps1 Input redirection through sort 1 Native sort utility is absent
CertificateProvider.Tests.ps1 Installed-certificate provider suite 1 Windows PowerShell certificate setup is unavailable
CmsMessage.Tests.ps1 Installed-certificate CMS suite 1 Windows PowerShell certificate setup is unavailable; the embedded-certificate case remains untagged
ConstrainedLanguageRestriction.Tests.ps1 ADODB COM activation 1 Desktop COM class is absent
Get-FileHash.Tests.ps1 Locked page-file hash 1 Native MI-backed page-file lookup is unavailable
Invoke-Item.Tests.ps1 Folder invocation 1 Desktop shell is absent
New-Object.Tests.ps1 Windows Update COM classes 2 Desktop COM classes are absent
ModulePath.Tests.ps1 Windows PowerShell path assumptions 4 Windows PowerShell is absent
FileSignature.Tests.ps1 Generated certificate signatures 1 WinCompat/certificate-store setup is unavailable

PR Context

The diagnostic lane is an x64 base WinPE guest running as SYSTEM, with the portable PowerShell ZIP, Pester 4.10.1, test assets, and selected native helpers. It intentionally has no supported PowerShell remoting, native MI runtime, Windows PowerShell, desktop shell, normal user lifecycle, or non-base OS components.

Pester 4 accepts nested Context -Tag, but ignores it with -ExcludeTag; the effective metadata therefore requires outermost tagged Describe blocks. The large mixed suites were partitioned while preserving their original test-case matrices and ordinary execution counts.

Deliberately retained failures in touched files:

  • 23 filesystem symlink, junction, hardlink, and OneDrive-emulation behaviors
  • 7 tab-completion help and enum-completion differences
  • 6 Get-ChildItem formatting/protected-file differences
  • 1 ModuleIntrinsics/PowerShellGet setup failure
  • 1 unrelated Import-Module ModuleBase-path failure
  • 1 Start-Process environment-reset difference

Validation performed:

  • All 25 edited files parse successfully.
  • All 41 NotWinPE tags are outermost Describe tags; no nested or It tags remain.
  • Pester 4.10.1 emitted no outermost-tag warnings.
  • Representative normal/excluded deltas include TabCompletion 836 -> 775, WinCompat 365 -> 256, and service mutation 50 -> 36.
  • The untagged embedded CMS certificate test runs both normally and with -ExcludeTag NotWinPE.
  • Baseline XML mapping found no previously passing assertion among the directly matched tagged cases.
  • A fresh WinPE run will be attached after the PR merge ref is available.

PR Checklist

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jshigetomi
Justin Chung (jshigetomi) requested a review from a team as a code owner October 9, 2026 19:24
Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:24
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two Windows PowerShell-dependent tests can falsely pass in WinPE, and one pending path continues executing assertions.

4 open findings
What changed in this PR

Adds outermost NotWinPE tags to exclude tests requiring unavailable WinPE capabilities while retaining compatible coverage.

Changes:

  • Splits mixed Pester suites for Pester 4 tag filtering.
  • Tags remoting, MI, WinCompat, desktop, and native-tool tests.
  • Corrects remote Copy-Item destination assertions.
File Description
Host/​HostUtilities.Tests.ps1 Tags remote-runspace tests.
Host/​TabCompletion/​TabCompletion.Tests.ps1 Separates WinPE-incompatible completion suites.
Language/​Scripting/​Indexer.Tests.ps1 Isolates CIM indexer tests.
Language/​Scripting/​NativeExecution/​NativeCommandArguments.Tests.ps1 Tags script-host tests.
Language/​Scripting/​NativeExecution/​NativeCommandProcessor.Tests.ps1 Tags native utility and VHD tests.
Language/​Scripting/​OrderedAttributeForHashTables.Tests.ps1 Isolates CIM ordered-property tests.
Modules/​Microsoft.PowerShell.Core/​CompatiblePSEditions.Module.Tests.ps1 Partitions local and WinCompat coverage.
Modules/​Microsoft.PowerShell.Core/​Enter-PSHostProcess.Tests.ps1 Isolates Windows PowerShell host tests.
Modules/​Microsoft.PowerShell.Core/​Get-PSHostProcessInfo.Tests.ps1 Isolates Windows PowerShell discovery.
Modules/​Microsoft.PowerShell.Core/​Import-Module.Tests.ps1 Tags GAC-dependent module tests.
Modules/​Microsoft.PowerShell.Core/​Job.Tests.ps1 Isolates PowerShell 5.1 jobs.
Modules/​Microsoft.PowerShell.Management/​Copy-Item.Tests.ps1 Separates remote tests and fixes assertions.
Modules/​Microsoft.PowerShell.Management/​FileSystem.Tests.ps1 Tags desktop and Storage-dependent tests.
Modules/​Microsoft.PowerShell.Management/​Get-ChildItem.Tests.ps1 Isolates volume-path coverage.
Modules/​Microsoft.PowerShell.Management/​Get-Service.Tests.ps1 Isolates security-descriptor tests.
Modules/​Microsoft.PowerShell.Management/​Set-Service.Tests.ps1 Separates unsupported service operations.
Modules/​Microsoft.PowerShell.Management/​Start-Process.Tests.ps1 Isolates native sort coverage.
Modules/​Microsoft.PowerShell.Security/​CertificateProvider.Tests.ps1 Tags installed-certificate tests.
Modules/​Microsoft.PowerShell.Security/​CmsMessage.Tests.ps1 Separates embedded and installed certificates.
Modules/​Microsoft.PowerShell.Security/​ConstrainedLanguageRestriction.Tests.ps1 Isolates desktop COM activation.
Modules/​Microsoft.PowerShell.Utility/​Get-FileHash.Tests.ps1 Isolates page-file hashing.
Modules/​Microsoft.PowerShell.Utility/​Invoke-Item.Tests.ps1 Isolates desktop folder invocation.
Modules/​Microsoft.PowerShell.Utility/​New-Object.Tests.ps1 Separates Windows Update COM tests.
engine/​Module/​ModulePath.Tests.ps1 Separates Windows PowerShell path tests.
engine/​Security/​FileSignature.Tests.ps1 Tags generated-certificate signature tests.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

param($inputStr, $expected)

if (Test-IsWindowsArm64) {
Set-ItResult -Pending -Because "TBD"
Comment on lines +1812 to +1813
Describe "WinCompat command error handling" -Tag "CI" {
It 'ErrorAction should be used for cmdlet' -Skip:(-not $IsWindows) {
Comment on lines +108 to +112
It 'Windows PowerShell does not inherit path defined in powershell.config.json' -Skip:(!$IsWindows) {
try {
$userConfig = '{ "PSModulePath": "myUserPath" }'
Set-Content -Path $userConfigPath -Value $userConfig -Force
$out = & $powershell -noprofile -command 'powershell.exe -noprofile -command `$env:PSModulePath'
$PSDefaultParameterValues["it:skip"] = ![System.Management.Automation.Platform]::IsWindowsDesktop

Describe "New-Object COM functionality" -Tags "CI" {
It "Should fail with correct error when creating a COM object that dose not exist" {
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Oct 17, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants