From 42e8deb9696601cc94852cf0646c84230efc85d7 Mon Sep 17 00:00:00 2001 From: David Weber Date: Tue, 10 Oct 2017 15:37:17 -0400 Subject: [PATCH] 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. --- build.psm1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.psm1 b/build.psm1 index ecfd3f9cc6..cc695d5574 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"