Repository navigation
Add Microsoft.PowerShell.Platform module - #623
Merged
Merged
Conversation
- Exports the IsCore, IsLinux, IsOSX, and IsWindows variables - Imported by the default PSL profile - Can be used automatically in Pester tests and Open PowerShell sessions - Should maybe become a default module once it is polished - PowerShellGitHubDev module does not explicitly use it because on FullCLR PowerShell (normal Windows development) it will not be imported automatically
Uses the $IsWindows etc. booleans from the Microsoft.PowerShell.Platform module instead of sourcing Test-Common repeatedly.
These should never have passed.
Instead of UTF-8 with BOM. Resolves #417.
Resolves #606.
Member
Author
Contributor
|
looks good |
Member
Author
|
Paul Allen (@paulcallen) Thanks. |
Andy Jordan (andyleejordan)
added a commit
that referenced
this pull request
Mar 5, 2016
Add Microsoft.PowerShell.Platform module
Thatgfsj (Thatgfsj)
pushed a commit
to Thatgfsj-contribs/PowerShell
that referenced
this pull request
Aug 6, 2026
Add Microsoft.PowerShell.Platform module
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.
With the
Microsoft.PowerShell.Platformmodule, I was able to massively improve the Pester tests cross-platform compatibility, such that tests that don't certain operating systems are skipped instead of silently passed (thanks sergei (@vors) for the tip).Since this module is not (yet) a "system" module, the default profile imports it, and the CI systems import it manually (since they run with
--noprofile).While I was at it, I also cleaned up all the Pester tests formatting; converted them to ASCII; removed hacky attempts to determine the OS and temporary folder; deprecated the repeated import of
Test-Common(and removed it); and replaced a convoluted setting of$herewith$PSScriptRoot.The
PSVersionTabletests were updated for the newPSEditionkey/value pair. TheNew-TimeSpantest had its tolerance increased so it doesn't randomly fail. TheGet-Locationtests were corrected. TheAdd-Typetest was re-enabled on Windows as the updated monad codebase fixed its failure.I think we should not import the module in the default profile, as it produces an error message when starting Core PowerShell on Windows because the default
PSModulePathdoes not includebin/Modules. ThePlatformmodule should be added to the default set of modules so it is always loaded. ThePSModulePathfor Core PowerShell ought to always contain onlybin/Modules. However, I'd like to do this in a separate work-item after discussion with the PowerShell teams.