[release/v7.6] Fix a preview detection test for the packaging script#26971
Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from Mar 9, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Backport to release/v7.6 that adjusts a packaging test to correctly validate preview-version detection in the packaging script test suite.
Changes:
- Converts the preview detection verification test into a parameterized Pester test covering both
-previewand-rcversions. - Removes the old “incorrect logic” assertion and instead validates the actual packaging helper output.
Comment on lines
+49
to
+56
| It "Should NOT use package name for preview detection (bug fix verification) - <Name>" -TestCases @( | ||
| @{ Version = "7.6.0-preview.6"; Name = "Preview" } | ||
| @{ Version = "7.6.0-rc.1"; Name = "RC" } | ||
| ) { | ||
| # This test verifies the fix for issue #26673 | ||
| # The bug was using ($Name -like '*-preview') which always returned false | ||
| # because preview builds use Name="powershell" not "powershell-preview" | ||
|
|
||
| $Version = "7.6.0-preview.6" | ||
| $Name = "powershell" # Preview builds use "powershell" not "powershell-preview" | ||
|
|
||
| # The INCORRECT logic (the bug): $Name -like '*-preview' | ||
| $incorrectCheck = $Name -like '*-preview' | ||
| $incorrectCheck | Should -Be $false -Because "Package name is 'powershell' not 'powershell-preview'" | ||
|
|
||
| param($Version) |
There was a problem hiding this comment.
The updated test no longer checks anything about the package name (the test cases use Name only for display), but the It description and the comments still describe a package-name-based bug ($Name -like '*-preview'). This makes the test misleading and harder to maintain. Please update the It text/comments to match the actual assertion (e.g., that preview detection is based on the version string and that both -preview and -rc are treated as preview).
adityapatwardhan
approved these changes
Mar 9, 2026
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.
Backport of #26882 to release/v7.6
Triggered by @daxian-dbw on behalf of @daxian-dbw
Original CL Label: CL-BuildPackaging
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Fixes a test in the packaging script that validates preview version detection. Ensures packaging tests work correctly.
Customer Impact
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Verified by running the fixed test in the packaging script. The test now correctly detects preview versions. Backported to v7.4 and v7.5 with PRs awaiting merge.
Risk
REQUIRED: Check exactly one box.
Low risk as this only fixes a test in the packaging script. The change affects test code verification only and does not impact production packaging behavior or runtime functionality.