Skip to content

Commit

Permalink
Merge pull request #1013 from v1v/feature/junit-windows-pester
Browse files Browse the repository at this point in the history
[Hacktoberfest] Support JUnit format for Windows tests
  • Loading branch information
slide authored Nov 3, 2020
2 parents 0e7ecea + 83bd560 commit 47f7477
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ stage('Build') {
}

stage('Test') {
powershell './make.ps1 test'
def windowsTestStatus = powershell('./make.ps1 test', returnStatus: true)
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'target/**/junit-results.xml')
if (windowsTestStatus > 0) {
error('Windows test stage failed.')
}
}

def branchName = "${env.BRANCH_NAME}"
Expand Down
12 changes: 8 additions & 4 deletions make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,17 @@ if($target -eq "test") {
}

if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)) {
$env:FOLDER = $builds[$Build]['Folder']
Invoke-Pester -Path tests -EnableExit
$folder = $builds[$Build]['Folder']
$env:FOLDER = $folder
New-Item -Path ".\target\$folder" -Type Directory
Invoke-Pester -Path tests -EnableExit -OutputFile ".\target\$folder\junit-results.xml" -OutputFormat JUnitXml
Remove-Item -Force env:\FOLDER
} else {
foreach($b in $builds.Keys) {
$env:FOLDER = $builds[$b]['Folder']
Invoke-Pester -Path tests -EnableExit
$folder = $builds[$b]['Folder']
$env:FOLDER = $folder
New-Item -Path ".\target\$folder" -Type Directory
Invoke-Pester -Path tests -EnableExit -OutputFile ".\target\$folder\junit-results.xml" -OutputFormat JUnitXml
Remove-Item -Force env:\FOLDER
}
}
Expand Down

0 comments on commit 47f7477

Please sign in to comment.