{{ message }}
Repository navigation
Tag WinPE-incompatible Pester tests - #28177
Open
Justin Chung (jshigetomi) wants to merge 1 commit into
Open
Justin Chung (jshigetomi) wants to merge 1 commit into
Justin Chung (jshigetomi) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 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-Itemdestination 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" { |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



PR Summary
Adds evidence-based
NotWinPEtags 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 outermostDescribe; 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-Itemassertions so they inspect their actualTemp2andTemp3destinations instead of fixtures left by an earlier suite.HostUtilities.Tests.ps1TabCompletion.Tests.ps1Indexer.Tests.ps1NativeCommandArguments.Tests.ps1cscript.exeis absentNativeCommandProcessor.Tests.ps1OrderedAttributeForHashTables.Tests.ps1New-CimInstanceordered propertiesCompatiblePSEditions.Module.Tests.ps1Enter-PSHostProcess.Tests.ps1Get-PSHostProcessInfo.Tests.ps1Import-Module.Tests.ps1Job.Tests.ps1Start-Job -PSVersion 5.1Copy-Item.Tests.ps1FileSystem.Tests.ps1runas.exeaccess and cross-drive move suitesGet-ChildItem.Tests.ps1Get-Volume/Storage support is absentGet-Service.Tests.ps1sc.exeis absentSet-Service.Tests.ps1Start-Process.Tests.ps1sortsortutility is absentCertificateProvider.Tests.ps1CmsMessage.Tests.ps1ConstrainedLanguageRestriction.Tests.ps1Get-FileHash.Tests.ps1Invoke-Item.Tests.ps1New-Object.Tests.ps1ModulePath.Tests.ps1FileSignature.Tests.ps1PR 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 taggedDescribeblocks. The large mixed suites were partitioned while preserving their original test-case matrices and ordinary execution counts.Deliberately retained failures in touched files:
Get-ChildItemformatting/protected-file differencesImport-ModuleModuleBase-path failureStart-Processenvironment-reset differenceValidation performed:
NotWinPEtags are outermostDescribetags; no nested orIttags remain.TabCompletion836 -> 775, WinCompat 365 -> 256, and service mutation 50 -> 36.-ExcludeTag NotWinPE.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header