forked from majkinetor/au
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ps1
30 lines (23 loc) · 799 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
30
param(
[switch]$Chocolatey,
[switch]$Pester,
[string]$Tag,
[switch]$CodeCoverage
)
if (!$Chocolatey -and !$Pester) { $Chocolatey = $Pester = $true }
$build_dir = gi $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 = @(ls $PSScriptRoot/AU/* -Filter *.ps1 -Recurse | % FullName)
Invoke-Pester -Tag $Tag -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru -CodeCoverage $files
} else {
Invoke-Pester -Tag $Tag -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru
}
}