PowerShell/test/powershell
Andrew c0aafdb3d0 Fixing a bug related to ModuleSpec syntax in RequiredModules (#3594)
This fixes issue #2607.
'RequiredModules' is a field in module manifest that can reference other modules using ModuleSpecification format.
The basic version of this format (just module name) was working fine, however, there was a problem when a more detailed version of the format was used (the one that uses module versions or/and GUIDs).
During module import, there is a check for cyclic references through 'RequiredModules' field. The bug was in this check for cyclic references, related to comparison rules for ModuleSpecification objects - as a result, the code was incorrectly reporting 'cyclic reference' error in cases when there was none.
Also, added tests for different ModuleSpecification formats and a test for error when there is actually a cyclic reference.
2017-04-30 17:58:44 -07:00
..
Common Autoload TestRemoting.psm1 (#3430) 2017-03-29 10:11:02 -07:00
engine Fixing a bug related to ModuleSpec syntax in RequiredModules (#3594) 2017-04-30 17:58:44 -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 Mark '-SkipCertificateCheck' tests pending on OSX for now (#3660) 2017-04-27 18:15:59 -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.