Skip to content

Commit

Permalink
remove empty code coverage results
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT committed Jul 22, 2020
1 parent c77edfb commit 18e0d69
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ steps:
pushd $td
Write-Host "##[command]Executing go test -run "^Test" -race -v -coverprofile coverage.txt -covermode atomic $td | go-junit-report -set-exit-code > report.xml"
go test -run "^Test" -race -v -coverprofile coverage.txt -covermode atomic . | go-junit-report -set-exit-code > report.xml
# if no tests were actually run (e.g. examples) delete the coverage file so it's omitted from the coverage report
if (Select-String -path ./report.xml -pattern '<testsuites></testsuites>' -simplematch -quiet) {
Write-Host "##[command]Deleting empty coverage file"
rm coverage.txt
}
}
displayName: 'Run Tests'
workingDirectory: '${{parameters.GoWorkspace}}'
Expand Down

0 comments on commit 18e0d69

Please sign in to comment.