forked from dfinke/PowerShellHumanizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DoTests.ps1
45 lines (32 loc) · 1.04 KB
/
DoTests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
param(
[Switch]$UsePSCore
)
function Install-PSCore {
param(
$pscoreVerion = '6.2.0-preview.3',
$os = 'win-x64'
)
$unZipPath = "$env:TEMP\pscore"
if (!(Test-Path $unZipPath)) {
$outfile = "$env:TEMP\pscore.zip"
$url = "https://github.com/PowerShell/PowerShell/releases/download/v$($pscoreVerion)/PowerShell-$($pscoreVerion)-$($os).zip"
"Downloading PS Core"
Invoke-RestMethod $url -OutFile $outfile
"Unzipping PS Core"
Expand-Archive -Path $outfile -DestinationPath $unZipPath -Force
Remove-Item $outfile -ErrorAction SilentlyContinue
}
"$unZipPath\pwsh.exe"
}
if ($UsePSCore) {
$pwsh = Install-PSCore -os 'win-x64'
& $pwsh[-1]
}
$PSVersionTable.PSVersion
if ($null -eq (Get-Module -ListAvailable pester)) {
Install-Module -Name Pester -Repository PSGallery -Force -Scope CurrentUser
}
$result = Invoke-Pester -Script $PSScriptRoot\__tests__ -Verbose -PassThru
if ($result.FailedCount -gt 0) {
throw "$($result.FailedCount) tests failed."
}