-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.ps1
29 lines (23 loc) · 828 Bytes
/
test.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
param(
[switch]$Chocolatey,
[switch]$Pester,
[string]$Tag,
[switch]$CodeCoverage
)
if (!$Chocolatey -and !$Pester) { $Chocolatey = $Pester = $true }
$build_dir = Get-Item $PSScriptRoot/_build/*
if ($Chocolatey) {
Write-Host "`n==| Running Chocolatey tests"
. $PSScriptRoot/AU/Public/Test-Package.ps1
Test-Package $build_dir
}
if ($Pester) {
Write-Host "`n==| Running Pester tests"
$testResultsFile = "$build_dir/TestResults.xml"
if ($CodeCoverage) {
$files = @(Get-ChildItem $PSScriptRoot/AU/* -Filter *.ps1 -Recurse | ForEach-Object FullName)
Invoke-Pester -Tag $Tag -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru -CodeCoverage $files
} else {
Invoke-Pester -Tag $Tag -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru
}
}