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

Tag WinPE- and min-size-incompatible Pester tests - #28177

Open
Justin Chung (jshigetomi) wants to merge 2 commits into
masterfrom
winpe-test-tagging
Open

Justin Chung (jshigetomi) wants to merge 2 commits into
masterfrom
winpe-test-tagging

Conversation

@jshigetomi

@jshigetomi Justin Chung (jshigetomi) commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

PR Summary

Adds filterable NotWinPE and NotMinSize metadata to PowerShell Pester tests based on the exhaustive PowerShell 7.6.8 WinPE x64 min-size run.

  • Adds 102 NotWinPE tag lines for tests that require capabilities absent from base WinPE, including native MI/CIM/CDXML, remoting and WSMan, Event Log infrastructure, desktop services and COM registrations, machine lifecycle operations, Windows PowerShell integration, and online help acquisition.
  • Adds 3 NotMinSize tag lines for WPF, Windows Forms, and localized satellite assemblies intentionally omitted by the min-size build.
  • Splits mixed suites so compatible validation, offline EVTX, API, and error-handling assertions remain enabled in WinPE.
  • Keeps ambiguous filesystem, registry, help, WebCmdlet, package-management, and product-behavior failures enabled for follow-up runs.
  • Makes performance-counter path translation fall back to the original path when localization data is unavailable.

PR Context

The WinPE lane runs the signed x64 min-size runtime as SYSTEM in a base WinPE guest with Pester 4.10.1. The diagnostic run discovered all 418 test files and recorded 13,913 cases, including 589 guest-side failures.

Pester 4.10.1 accepts tag syntax on nested Context blocks but does not honor those tags during -ExcludeTag filtering. All compatibility tags in this PR are therefore on outermost Describe groups. Mixed suites were partitioned while preserving their normal test matrices and inherited setup.

The intended WinPE invocation is:

Invoke-Pester -ExcludeTag 'NotWinPE', 'NotMinSize'

The Release-Automation lane will enable that filter only after its coordinated test package contains these tags.

Validation

  • All changed PowerShell scripts parse successfully.
  • All NotWinPE and NotMinSize tags are on filterable outermost test groups; none are on It blocks or nested Pester groups.
  • Representative Pester 4.10.1 filtered suites preserve the expected untagged cases for Get-WinEvent, New-WinEvent, Get-ComputerInfo, COM, and localized resources.
  • Broad Get-Counter exclusions were deliberately removed pending a WinPE rerun with the helper correction.

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

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

Add filterable top-level NotWinPE and NotMinSize suites for capabilities unavailable in base WinPE or the min-size build. Preserve compatible validation and offline-event coverage, and keep ambiguous failures enabled for reruns.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: eaee217d-4a12-4dea-bf6d-229736936172
@jshigetomi Justin Chung (jshigetomi) changed the title Tag WinPE-incompatible Pester tests Tag WinPE- and min-size-incompatible Pester tests Oct 21, 2026
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