Skip to content

Add Microsoft.PowerShell.Platform module - #623

Merged
Andy Jordan (andyleejordan) merged 13 commits into
masterfrom
xplat-pester
Mar 5, 2016
Merged

Andy Jordan (andyleejordan) merged 13 commits into
masterfrom
xplat-pester

Conversation

@andyleejordan

Copy link
Copy Markdown
Member

With the Microsoft.PowerShell.Platform module, 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 $here with $PSScriptRoot.

The PSVersionTable tests were updated for the new PSEdition key/value pair. The New-TimeSpan test had its tolerance increased so it doesn't randomly fail. The Get-Location tests were corrected. The Add-Type test 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 PSModulePath does not include bin/Modules. The Platform module should be added to the default set of modules so it is always loaded. The PSModulePath for Core PowerShell ought to always contain only bin/Modules. However, I'd like to do this in a separate work-item after discussion with the PowerShell teams.

- 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.
@andyleejordan

Copy link
Copy Markdown
Member Author

Note, for the best reviewing experience, use git log -p locally and ignore de6a452, 0aaf74b, and 0c6b14a.

@paulcallen

Copy link
Copy Markdown
Contributor

looks good

@andyleejordan

Copy link
Copy Markdown
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
@andyleejordan
Andy Jordan (andyleejordan) merged commit 4b74418 into master Mar 5, 2016
@andyleejordan
Andy Jordan (andyleejordan) deleted the xplat-pester branch March 5, 2016 00:43
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Add Microsoft.PowerShell.Platform module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants