PowerShell/test/powershell
Steve Lee ee9049b61f New-ModuleManifest was incorrectly checking if a Uri was well formed by using ToString() which just outputs the original (#3631)
string.  If the string was a uri with spaces, ToString() doesn't return the escaped version.  The AbsoluteUri property
should be used instead which returns an escaped absolute uri (if valid).

Also renamed TestModuleManfest.ps1 to TestModuleManifest.Tests.ps1 so that it gets picked up correctly as Pester test.

Since HelpInfoUri is just a string, ensure it is a valid absolute uri and escaped correctly whereas before it was just
an opaque string that wasn't validated.
2017-04-25 17:45:24 -07:00
..
Common Autoload TestRemoting.psm1 (#3430) 2017-03-29 10:11:02 -07:00
engine New-ModuleManifest was incorrectly checking if a Uri was well formed by using ToString() which just outputs the original (#3631) 2017-04-25 17:45:24 -07:00
Host Fix tab completion with '@{<tab>' to avoid crash in PSReadline (#3626) 2017-04-25 09:42:43 -07:00
Language Add ErrorMessage property to ValidatePattern, ValidateSet and ValidateScript attributes (#2728) 2017-04-20 11:31:57 -07:00
Modules Added tests for Test Connection (#3604) 2017-04-25 09:53:17 -07:00
Provider Updated tags of automounted drives tests (#3290) 2017-03-08 16:34:39 -08:00
SDK Migrate from project.json to MSBuild (#3398) 2017-03-23 13:04:52 -07:00
README.md Fixed broken link in README (#2643) 2016-11-08 10:22:26 -08:00

Pester Testing Test Guide

Also see the Writing Pester Tests document.

Running Pester Tests

Go to the top level of the PowerShell repository and run: Start-PSPester inside a self-hosted copy of PowerShell.

You can use Start-PSPester -Tests SomeTestSuite* to limit the tests run.

Testing new powershell processes

Any launch of a new powershell process must include -noprofile so that modified user and system profiles do not causes tests to fail. You also must take care to call the development copy of PowerShell, which is not the first one on the path.

Example:

    $powershell = Join-Path -Path $PsHome -ChildPath "powershell"
    & $powershell -noprofile -command "ExampleCommand" | Should Be "ExampleOutput"

Portability

Some tests simply must be tied to certain platforms. Use Pester's -Skip directive on an It statement to do this. For instance to run the test only on Windows:

It "Should do something on Windows" -Skip:($IsLinux -Or $IsOSX) { ... }

Or only on Linux and OS X:

It "Should do something on Linux" -Skip:$IsWindows { ... }

Pending

When writing a test that should pass, but does not, please do not skip or delete the test, but use It "Should Pass" -Pending to mark the test as pending, and file an issue on GitHub.