@@ -3,19 +3,37 @@ platform: windows
33inputs :
44 - name : bosh-windows-stemcell-builder-ci
55 - name : stemcell-builder
6- - name : pester
6+
7+ params :
8+ STEMCELL_AUTOMATION_DIR : stemcell-builder/stembuild/stemcell-automation/
79
810run :
911 path : powershell
1012 args :
1113 - " -Command"
12- - " & {
13- Import-Module ./bosh-windows-stemcell-builder-ci/ci/common-scripts/setup-windows-container.psm1;
14- Set-TmpDir;
15- Import-Module ./Pester/pester.psm1;
16- pushd stemcell-builder/stembuild/stemcell-automation;
17- $result=Invoke-Pester -PassThru;
18- popd;
19- Write-Host \" Failed Tests:\" $result.FailedCount;
20- exit $result.FailedCount
21- }"
14+ - |
15+ & {
16+ function New-TemporaryDirectory {
17+ $tmp = [System.IO.Path]::GetTempPath() # Not $env:TEMP, see https://stackoverflow.com/a/946017
18+ $name = (New-Guid).ToString("N")
19+ New-Item -ItemType Directory -Path (Join-Path $tmp $name)
20+ }
21+ $moduleDir = New-TemporaryDirectory
22+ $pesterModule = Find-Module -Name Pester -MaximumVersion "5.9999" -MinimumVersion "5.0"
23+ $pesterModule | Save-Module -Path $moduleDir
24+ Import-Module "$moduleDir\Pester\$($pesterModule.Version)\Pester.psm1"
25+
26+ Import-Module ./bosh-windows-stemcell-builder-ci/ci/common-scripts/setup-windows-container.psm1
27+
28+ Set-TmpDir
29+ pushd $env:STEMCELL_AUTOMATION_DIR
30+ # NOTE: uncomment the lines below to see full stack trace
31+ # $configuration = New-PesterConfiguration
32+ # $configuration.Output.StackTraceVerbosity = "Full"
33+ # $result=Invoke-Pester -Configuration $configuration
34+ $result=Invoke-Pester -PassThru
35+ popd;
36+
37+ Write-Host "Failed Test Count:"$result.FailedCount
38+ exit $result.FailedCount
39+ }
0 commit comments