Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,16 @@ function Start-PSPester {
[switch]$IncludeFailingTest
)

if (-not (Get-Module -ListAvailable -Name $Pester -ErrorAction SilentlyContinue))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually prefer the Test-Path instead. With -ListAvailable the Pester version that comes installed with Windows 10 will be found. There are difference in those versions which might cause false errors in running tests.

Copy link
Author

@djweber djweber Oct 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adityapatwardhan Since the full path to the project's Pester module is being passed in here, I believe this would not be an issue:

PS /Users/david/Code/PowerShell> Get-Module -ListAvailable /Users/david/Code/PowerShell/src/powershell-unix/bin/Linux/netcoreapp2.0/osx.10.12-x64/publish/Modules/Pester  | Format-Table
Path -Groupby Name

   Name: Pester

Path
----
/Users/david/Code/PowerShell/src/powershell-unix/bin/Linux/netcoreapp2.0/osx.10.12-x64/publish/Modules/Pester/Pester.psd1

However, if we only passed in Pester, I could see that being a cause for concern:

PS /Users/david/Code/PowerShell> Get-Module -ListAvailable Pester | Format-Table Path -Groupby Name
   
   Name: Pester

Path
----
/usr/local/microsoft/powershell/6.0.0-beta.8/Modules/Pester/4.0.8/Pester.psd1
/usr/local/microsoft/powershell/6.0.0-beta.8/Modules/Pester/Pester.psd1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Misread it being Pester instead of $Pester.

{
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"
Expand Down