forked from EvotecIT/PSTeams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPSTeams.Tests.ps1
27 lines (22 loc) · 1.17 KB
/
PSTeams.Tests.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
param (
$TeamsID = $Env:TEAMSPESTERID
)
$PSVersionTable.PSVersion
$ModuleName = (Get-ChildItem $PSScriptRoot\*.psd1).BaseName
#+$ModuleVersion = (Get-Content -Raw $PSScriptRoot\*.psd1) | Invoke-Expression | ForEach-Object ModuleVersion
#$Dest = "Builds\$ModuleName-{0}-{1}.zip" -f $ModuleVersion, (Get-Date).ToString("yyyyMMddHHmmss")
#Compress-Archive -Path . -DestinationPath .\$dest
$Pester = (Get-Module -ListAvailable pester)
if ($null -eq $Pester -or ($Pester[0].Version.Major -le 4 -and $Pester[0].Version.Minor -lt 4)) {
Write-Warning "$ModuleName - Downloading Pester from PSGallery"
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -Scope CurrentUser
}
if ($null -eq (Get-Module -ListAvailable PSSharedGoods)) {
Write-Warning "$ModuleName - Downloading PSSharedGoods from PSGallery"
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -Scope CurrentUser
}
#$result = Invoke-Pester -Script $PSScriptRoot\Tests -PassThru
$result = Invoke-Pester -Script @{ Path = "$($PSScriptRoot)\Tests"; Parameters = @{ TeamsID = $TeamsID }; } -EnableExit
if ($result.FailedCount -gt 0) {
throw "$($result.FailedCount) tests failed."
}