diff --git a/go-junit-report_test.go b/go-junit-report_test.go index 05b1e70..1973077 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -807,6 +807,26 @@ var testCases = []TestCase{ }, }, }, + { + name: "21-cached.txt", + reportName: "21-report.xml", + report: &parser.Report{ + Packages: []parser.Package{ + { + Name: "package/one", + Time: 0, + Tests: []*parser.Test{ + { + Name: "TestOne", + Time: 0, + Result: parser.PASS, + Output: []string{}, + }, + }, + }, + }, + }, + }, } func TestParser(t *testing.T) { diff --git a/parser/parser.go b/parser/parser.go index 3ad7182..132fc31 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -42,7 +42,7 @@ type Test struct { var ( regexStatus = regexp.MustCompile(`--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)`) regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`) - regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`) + regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|\(cached\)|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`) regexOutput = regexp.MustCompile(`( )*\t(.*)`) regexSummary = regexp.MustCompile(`^(PASS|FAIL|SKIP)$`) ) diff --git a/testdata/21-cached.txt b/testdata/21-cached.txt new file mode 100644 index 0000000..50aadc1 --- /dev/null +++ b/testdata/21-cached.txt @@ -0,0 +1,4 @@ +=== RUN TestOne +--- PASS: TestOne (0.00s) +PASS +ok package/one (cached) diff --git a/testdata/21-report.xml b/testdata/21-report.xml new file mode 100644 index 0000000..a1b7e48 --- /dev/null +++ b/testdata/21-report.xml @@ -0,0 +1,9 @@ + + + + + + + + +