-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.pester.ps1
39 lines (31 loc) · 911 Bytes
/
appveyor.pester.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
$modulePath = $PSScriptRoot
$moduleName = $modulePath | Split-Path -Leaf
$pesterPaths = @(
@{
Path = ".\$moduleName.Tests.ps1"
} ,
@{
Path = '.\Private'
Parameters = @{}
} ,
@{
Path = '.\Public'
Parameters = @{}
}
)
$pesterPaths | ForEach-Object -Process {
$thisPath = $_
if ($thisPath.Parameters) {
$thisPath.Parameters.Module = $Global:TestModule
}
$params = @{
Path = $thisPath
OutputFormat = 'NUnitXml'
OutputFile = 'TestResults.xml'
}
$res = Invoke-Pester @params -PassThru
if ($env:APPVEYOR -eq [bool]::TrueString) {
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/${env:APPVEYOR_JOB_ID}", (Resolve-Path -Path $params.OutputFile))
if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed."}
}
}