Skip to content

Commit 8648745

Browse files
committed
parser/gotest: Don't ignore output when there were no tests
In some cases we may have captured some output for a package that didn't have any tests. We should include it in the generated report as it may contain useful information.
1 parent d84b41a commit 8648745

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

parser/gotest/report_builder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ func (b *reportBuilder) CreatePackage(name, result string, duration time.Duratio
210210
Name: name,
211211
Output: b.output.Get(globalID),
212212
}
213+
} else if b.output.Contains(globalID) {
214+
pkg.Output = b.output.Get(globalID)
213215
}
214216
b.packages = append(b.packages, pkg)
215217
b.output.Clear(globalID)

testdata/015-report.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<properties>
55
<property name="go.version" value="1.0"></property>
66
</properties>
7+
<system-out><![CDATA[testing: warning: no tests to run]]></system-out>
78
</testsuite>
89
</testsuites>

testdata/034-report.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<properties>
1010
<property name="go.version" value="1.0"></property>
1111
</properties>
12+
<system-out><![CDATA[testing: warning: no tests to run]]></system-out>
1213
</testsuite>
1314
<testsuite name="package/name" tests="0" failures="0" errors="0" id="2" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
1415
<properties>

testdata/111-report.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<properties>
55
<property name="go.version" value="1.0"></property>
66
</properties>
7+
<system-out><![CDATA[testing: warning: no tests to run]]></system-out>
78
</testsuite>
89
</testsuites>

0 commit comments

Comments
 (0)