-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: update ci workflows * ci: update node script * test: add a failing test to try CI output * ci: add gotestfmt templates * ci: fix ubuntu refs in workflwo * ci: restore clean trace
- Loading branch information
Showing
6 changed files
with
142 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,24 @@ | ||
const readline = require("readline"); | ||
const readline = require('readline'); | ||
|
||
// Create readline interface | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
terminal: false, | ||
terminal: false | ||
}); | ||
|
||
const summary = { fail: [], pass: [], skip: [] }; | ||
|
||
rl.on("line", (line) => { | ||
const output = JSON.parse(line); | ||
if ( | ||
output.Action === "pass" || | ||
output.Action === "skip" || | ||
output.Action === "fail" | ||
) { | ||
if (output.Test) { | ||
summary[output.Action].push(output); | ||
} | ||
} | ||
}); | ||
|
||
|
||
rl.on("close", () => { | ||
console.log("## Summary"); | ||
console.log("\n"); | ||
// console.log("| | # of Tests |"); | ||
// console.log("|--|--|"); | ||
console.log( | ||
"✅ Passed: %d", | ||
summary.pass.length | ||
); | ||
console.log( | ||
"❌ Failed: %d", | ||
summary.fail.length | ||
); | ||
console.log( | ||
"🚧 Skipped: %d", | ||
summary.skip.length | ||
); | ||
|
||
if (summary.fail.length > 0) { | ||
console.log("\n## ❌ Failures\n"); | ||
} | ||
|
||
summary.fail.forEach((test) => { | ||
console.log("* `%s` (%s)", test.Test, test.Package); | ||
}); | ||
|
||
// also display skipped tests. | ||
if (summary.skip.length > 0) { | ||
console.log("\n## 🚧 Skipped\n"); | ||
} | ||
|
||
summary.skip.forEach((test) => { | ||
console.log("* `%s` (%s)", test.Test, test.Package); | ||
}); | ||
let content = ''; | ||
|
||
// Read stdin content | ||
rl.on('line', (line) => { | ||
content += line + '\n'; | ||
}); | ||
|
||
rl.on('close', () => { | ||
// Escape special characters | ||
const escapedContent = content.replace(/"/g, ' '); | ||
// Convert the JSON object to a string | ||
const jsonStr = JSON.stringify(escapedContent); | ||
const jsonStr2 = jsonStr.slice(1, -1); | ||
console.log(jsonStr2); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{- /*gotype: github.com/gotesttools/gotestfmt/v2/parser.Downloads*/ -}} | ||
{{- /* | ||
This template contains the format for a package download. | ||
*/ -}} | ||
{{- $settings := .Settings -}} | ||
{{- if or .Packages .Reason -}} | ||
{{- if or (not .Settings.HideSuccessfulDownloads) .Failed -}} | ||
::group:: | ||
{{- if .Failed -}} | ||
{{ "\033" }}[0;31m❌ | ||
{{- else -}} | ||
{{ "\033" }}[0;34m📥 | ||
{{- end -}} | ||
{{ " " }}Dependency downloads | ||
{{- "\033" }}[0m{{ "\n" -}} | ||
|
||
{{- range .Packages -}} | ||
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}} | ||
{{- " " -}} | ||
{{- if .Failed -}} | ||
{{ "\033" }}[0;31m❌ | ||
{{- else -}} | ||
📦 | ||
{{- end -}} | ||
{{- " " -}} | ||
{{- .Package }} {{ .Version -}} | ||
{{- "\033" }}[0m | ||
{{- "\n" -}} | ||
{{ with .Reason -}} | ||
{{- " " -}}{{ . -}}{{ "\n" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- with .Reason -}} | ||
{{- " " -}}{{- "\033" }}[0;31m🛑 {{ . }}{{- "\033" }}[0m{{ "\n" -}} | ||
{{- end -}} | ||
::endgroup:: | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{- /*gotype: github.com/gotesttools/gotestfmt/v2/parser.Package*/ -}} | ||
|
||
{{- $settings := .Settings -}} | ||
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}} | ||
📦 `{{ .Name }}` | ||
{{- with .Coverage -}} | ||
({{ . }}% coverage) | ||
{{- end -}} | ||
{{- "\n" -}} | ||
{{- with .Reason -}} | ||
{{- " " -}}🛑 {{ . -}}{{- "\n" -}} | ||
{{- end -}} | ||
{{- with .Output -}} | ||
```{{- "\n" -}} | ||
{{- . -}}{{- "\n" -}} | ||
```{{- "\n" -}} | ||
{{- end -}} | ||
{{- with .TestCases -}} | ||
{{- range . -}} | ||
{{- if or (not $settings.HideSuccessfulTests) (ne .Result "PASS") -}} | ||
{{- if eq .Result "PASS" -}} | ||
✅ | ||
{{- else if eq .Result "SKIP" -}} | ||
🚧 | ||
{{- else -}} | ||
❌ | ||
{{- end -}} | ||
{{ " " }}`{{- .Name -}}` {{ .Duration -}} | ||
{{- "\n" -}} | ||
|
||
{{- with .Output -}} | ||
```{{- "\n" -}} | ||
{{- formatTestOutput . $settings -}}{{- "\n" -}} | ||
```{{- "\n" -}} | ||
{{- end -}} | ||
|
||
{{- "\n" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- "\n" -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters