Skip to content

Commit b9a8e1f

Browse files
committed
Improve Github Summary
1 parent 6ecfae0 commit b9a8e1f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

make-summary.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ function Get-Tests($label, $counts) {
1717
function Convert-Tests($params, $prefix = "") {
1818
if (($params[1] + $params[2]) -eq 0) {
1919
$label = "{0} successful"
20-
$text = "tests-{3:d}_passed%2C_{4:d}_skipped"
20+
$text = "{0}-{3:d}_passed%2C_{4:d}_skipped"
2121
$colour = "6F6"
2222
} else {
2323
$label = "{0} failed"
24-
$text = "tests-{1:d}_failed%2C{2:d}_errored%2C{3:d}_passed%2C_{4:d}_skipped"
24+
$text = "{0}-{1:d}_failed%2C{2:d}_errored%2C{3:d}_passed%2C_{4:d}_skipped"
2525
$colour = "F66"
2626
}
2727

@@ -40,7 +40,7 @@ function Write-Tests($params, $prefix = "") {
4040

4141
function Convert-Coverage($cover, $prefix = "") {
4242
$params = $cover.linesPerc, $cover.linesCovered, $cover.linesValid
43-
Get-Badge $params "Coverage" "coverage-{0:f2}%25_covered_{1:d}_of_{2:d}" "F6F" $prefix
43+
Get-Badge $params "Coverage" "Coverage-{0:f2}%25_covered_{1:d}_of_{2:d}" "F6F" $prefix
4444
}
4545

4646
function Write-Coverage($cover, $prefix = "") {
@@ -70,7 +70,7 @@ $coverage = Get-ChildItem coverage -Filter "Coverage*.xml" | ForEach-Object {
7070
$testParams = Get-ChildItem . -Recurse -Filter "TestResults*.trx" | ForEach-Object {
7171
[xml]$trx = Get-Content $_.FullName
7272

73-
$name = $_.Directory.Parent.Name
73+
$name = $_.Directory.Parent.Name -replace "GqlPlus\.","" -replace "\.","_"
7474
$counters = $trx.TestRun.ResultSummary.Counters
7575

7676
$allTests.total += $counters.total
@@ -82,7 +82,7 @@ $testParams = Get-ChildItem . -Recurse -Filter "TestResults*.trx" | ForEach-Obje
8282
Get-Tests $name $counters
8383
}
8484

85-
$allTestsParams = Get-Tests "All Tests" $allTests
85+
$allTestsParams = Get-Tests "All_Tests" $allTests
8686

8787
Write-Tests $allTestsParams.params
8888
if ($testParams.Count -gt 1) {
@@ -97,15 +97,15 @@ if ($ShowGithub) {
9797
if ($testParams.Count -gt 1) {
9898
$testParams | ForEach-Object { Write-Host (Convert-Tests $_.params "- ") }
9999
}
100-
Write-Host (Convert-Coverage $allCoverage)
100+
Write-Host (Convert-Coverage $allCoverage "`n")
101101
}
102102

103103
if ($env:GITHUB_STEP_SUMMARY) {
104104
Convert-Tests $allTestsParams.params | Set-Content $env:GITHUB_STEP_SUMMARY
105105
if ($testParams.Count -gt 1) {
106106
$testParams | ForEach-Object { Convert-Tests $_.params "- " } | Add-Content $env:GITHUB_STEP_SUMMARY
107107
}
108-
Convert-Coverage $allCoverage | Add-Content $env:GITHUB_STEP_SUMMARY
108+
Convert-Coverage $allCoverage "`n" | Add-Content $env:GITHUB_STEP_SUMMARY
109109
}
110110

111111
if ($env:GITHUB_OUTPUT) {

0 commit comments

Comments
 (0)