diff --git a/cmd/web5-spec-test/report-template.md b/cmd/web5-spec-test/report-template.md index 8712e4c..0b21255 100644 --- a/cmd/web5-spec-test/report-template.md +++ b/cmd/web5-spec-test/report-template.md @@ -8,6 +8,6 @@ SDK: [{{ .TestServerID.Name }}]({{ .TestServerID.Url }}) ({{ .TestServerID.Langu | Feature | Result | | ------- | ------ |{{ range $test, $result := $results }} -| {{ $test }} | {{ if $result }}:x: {{ else }}:heavy_check_mark:{{ end }} |{{ end }} +| {{ $test }} | {{ $result | getEmoji}}{{ if $result }} {{ end }} |{{ end }} {{ end }} diff --git a/cmd/web5-spec-test/report-template.txt b/cmd/web5-spec-test/report-template.txt index db96dcc..601148d 100644 --- a/cmd/web5-spec-test/report-template.txt +++ b/cmd/web5-spec-test/report-template.txt @@ -3,5 +3,5 @@ web5 spec conformance report for {{ .TestServerID.Name }} ({{ .TestServerID.Url {{ range $groupName, $results := .Results }} {{ $groupName }} ======================{{ range $test, $result := $results }} -{{ $test }}: {{ if $result }}❌ fail: {{ $result }}{{ else }}✅ pass{{ end }}{{ end }} +{{ $test }}: {{ $result | getEmoji }} {{ if $result }}fail: {{ $result }}{{ else }}pass{{ end }}{{ end }} {{ end }} diff --git a/cmd/web5-spec-test/reports.go b/cmd/web5-spec-test/reports.go index 4c6ac68..42dcd60 100644 --- a/cmd/web5-spec-test/reports.go +++ b/cmd/web5-spec-test/reports.go @@ -8,6 +8,7 @@ import ( "text/template" "github.com/TBD54566975/web5-spec/openapi" + "github.com/TBD54566975/web5-spec/tests" ) //go:embed report-template.* @@ -18,6 +19,7 @@ var templates = template.New("") func init() { templates.Funcs(template.FuncMap{ "sanatizeHTML": sanatizeHTML, + "getEmoji": getEmoji, }) templates.ParseFS(reportTemplateFS, "report-template.*") } @@ -28,10 +30,17 @@ type Report struct { } func (r Report) IsPassing() bool { - for _, errs := range r.Results { - if len(errs) > 0 { - return false + for _, results := range r.Results { + for _, errs := range results { + if len(errs) == 1 && errs[0] == tests.ErrNotSupported { + continue + } + + if len(errs) > 0 { + return false + } } + } return true @@ -69,3 +78,15 @@ func sanatizeHTML(dirty error) string { return clean } + +func getEmoji(errs []error) string { + if len(errs) == 0 { + return "✅" + } + + if len(errs) == 1 && errs[0] == tests.ErrNotSupported { + return "🚧" + } + + return "❌" +}