Add warning to Start-PSPester if Pester module not found (#5069)

Currently, if a user does not clone with the `--recursive` flag or run `git submodule update --init`, `Start-PSPester` will fail to run due to the missing Pester module. While the error hints at the Pester module not being found, there is no suggested way of fixing the issue presented to the user.
This change makes a helpful warning to appear at the beginning of the execution of `Start-PSPester` if the Pester module cannot be found.
This commit is contained in:
David Weber 2017-10-10 15:37:17 -04:00 committed by Dongbo Wang
parent 983409f80e
commit 42e8deb969

View file

@ -848,6 +848,16 @@ function Start-PSPester {
[switch]$IncludeFailingTest
)
if (-not (Get-Module -ListAvailable -Name $Pester -ErrorAction SilentlyContinue))
{
Write-Warning @"
Pester module not found.
Make sure that the proper git submodules are installed by running:
git submodule update --init
"@
return;
}
if ($IncludeFailingTest.IsPresent)
{
$Path += "$PSScriptRoot/tools/failingTests"