forked from dfinke/NameIT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContinuousIntegration.ps1
40 lines (30 loc) · 955 Bytes
/
ContinuousIntegration.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
$PSVersionTable
$modules = @("Pester", "PSScriptAnalyzer")
foreach ($module in $modules) {
Write-Host "Installing $module" -ForegroundColor Cyan
Install-Module $module -Force -SkipPublisherCheck
Import-Module $module -Force -PassThru
}
$pesterResults = Invoke-Pester -Output Detailed -PassThru
# $os = if($IsWindows) {
# "windows"
# } elseif ($IsMacOS) {
# "macos"
# } elseif($IsLinux) {
# "linux"
# }
# $pesterResults | Export-NUnitReport -Path "./pesterTestResults-$os.xml"
if (!$pesterResults) {
Throw "Tests failed"
}
else {
if ($pesterResults.FailedCount -gt 0) {
'[Progress] Pester Results Failed'
$pesterResults.Failed | Out-String
'[Progress] Pester Results FailedBlocks'
$pesterResults.FailedBlocks | Out-String
'[Progress] Pester Results FailedContainers'
$pesterResults.FailedContainers | Out-String
Throw "Tests failed"
}
}