-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
PSEventViewer.Tests.ps1
25 lines (19 loc) · 1.04 KB
/
PSEventViewer.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
$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
}
import-module .\PSEventViewer.psd1 -Force
$result = Invoke-Pester -Path $PSScriptRoot\Tests
if ($result.FailedCount -gt 0) {
throw "$($result.FailedCount) tests failed."
}