From bd1fdc4b4ddbc6286a7206eb9522c4c6b4ac6d7e Mon Sep 17 00:00:00 2001 From: David Weber Date: Mon, 9 Oct 2017 17:22:36 -0400 Subject: [PATCH] Add warning to Start-PSPester if Pester module not found 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 Pester module missing. 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. --- build.psm1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.psm1 b/build.psm1 index ecfd3f9cc6f..cc695d55742 100644 --- a/build.psm1 +++ b/build.psm1 @@ -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"