Commit Graph

350 Commits

Author SHA1 Message Date
075629ad5f junit: Add Testsuites.WriteXML method 2022-09-30 23:04:10 +01:00
b1271c39f9 Restrict Github workflow job permissions 2022-09-30 22:48:06 +01:00
79c139d4b9 Add pkg.go.dev badge to README 2022-09-29 21:51:37 +01:00
292aab72b9 parser/gotest: Only run fuzz tests on Go versions that support it 2022-09-27 22:01:35 +01:00
9b4f5520f7 Add test for reports without properties 2022-09-27 21:51:00 +01:00
3445b88cb1 parser/gotest: Add fuzzing test for parseLine 2022-09-24 20:52:08 +01:00
f50ae24655 Merge pull request #144 from kevinxw/master
Fix regular expression for summary with "no statements" coverage.
2022-09-22 23:24:50 +01:00
03f6f9e2dc Merge branch 'jstemmer:master' into master 2022-09-22 12:48:14 -07:00
9c64855bf7 Fix regular expression for summary with "no statements" coverage.
Move the status message to the end of the regular expression.
2022-09-22 19:46:38 +00:00
934b104ddd junit: Remove properties helper function in junit_test.go 2022-09-17 22:37:47 +01:00
2b3d79c572 junit: Specify unicode replacement character as \uFFFD
This is just to make the exact character we want to return explicit,
otherwise it could be confused by any unsupported character in your text
editor.
2022-09-17 22:33:04 +01:00
84a5190347 Escape illegal XML characters in junit output (#140) 2022-09-17 22:26:44 +01:00
97e0285183 parser/gotest: Handle build errors in test packages with _test suffix
It's possible for test files to declare a package with the "_test"
suffix. If these packages contain build errors, they were not correctly
matched to the package without the "_test" suffix.

Refs #145
2022-09-17 01:09:34 +01:00
81e5aaaaf1 parser/gotest: Make sure every build error is processed
Make sure we don't ignore any build error that did not belong to a
package. This isn't expected to normally happen, but we need to handle
it anyway to prevent accidentally ignoring potential errors.

Refs #145
2022-09-17 01:09:15 +01:00
cb3436fc5f parser/gotest: Do not ignore failures in a test summary
The ReportBuilder ignores summary results if we never collected any
events for that package. While under normal circumstances we wouldn't
expect this to happen (unless some output was lost or due to a bug in
go-junit-report), we should at the very least make sure that failed
results are not ignored.

Refs #145
2022-09-17 00:06:11 +01:00
77475bf23b parser/gotest: Fix test error messages in report_builder_test.go 2022-09-17 00:03:11 +01:00
7b10b42854 Merge pull request #141 from jstemmer/refactor-report-builder
Refactor report builder to support interleaved events from different packages
2022-08-23 23:04:51 +01:00
c796dcf8d1 junit: Remove unused indent parameter from formatOutput function 2022-08-23 23:04:15 +01:00
917d9f7023 Merge pull request #143 from greg-dennis/master
Report stores a slice of Property structs instead of a map
2022-08-23 23:03:23 +01:00
bf9aa098bb Fix SetProperty and add unit test. 2022-08-23 13:53:51 -04:00
15d215e49d Report stores a slice of Property structs rather than a map, to mimic JUnit properties, which have a deterministic ordering and allow multipler properties with the same name. 2022-08-23 10:41:42 -04:00
35c4d8a827 Merge pull request #142 from greg-dennis/patch-1
go-junit-report_test should fail if no files found
2022-08-19 21:31:31 +01:00
39473dc54e go-junit-report_test should fail if no files found
Today, if the testdata directory isn't present, this test trivially passes. This makes it fail when no files are found.
2022-08-19 10:55:25 -04:00
4d0ed8b681 Add testdata for go test -json -race tests.
Refs #134
2022-08-15 22:35:27 +01:00
9357c180d4 parser/gotest: Add support for processing events for different packages
The reportBuilder assumed we were always processing events for a single
package at a time. This is not true however when running `go test -json
-race` for example. In order to properly support processing events from
different packages we now have packageBuilders per package name.

Fixes #134
2022-08-15 22:35:27 +01:00
85f2715ac9 parser/gotest: Create JSONEventReader in internal reader package
The JSONEventReader implements reading lines with metadata and replaces
the gotest.jsonReader struct.
2022-08-15 22:07:52 +01:00
bd21d54501 parser/gotest: Add Package to Event
This allows each event to belong to a package, if we know it in advance.
2022-08-15 22:07:52 +01:00
f6f9df42b9 parser/gotest: Create interface for reading lines with metadata 2022-08-15 22:07:52 +01:00
27ad87e370 parser/gotest: parseLine now returns the events it creates 2022-08-15 22:07:52 +01:00
2af321a697 parser/gotest: Refactor benchmark grouping
The only reason groupBenchmarksByName needed the reportBuilder receiver
was to access its output collector. By passing the output explicitly to
the groupBenchmarksByName function we can remove the reportBuilder
dependency.
2022-08-15 22:05:38 +01:00
b73e4a9ed5 parser/gotest: Remove unnecessary if statement when creating a package
We only execute this branch when we've captured some global output, so
no need to check that again.
2022-08-13 22:06:49 +01:00
4ce910564c parser/gotest: timestampFunc should always be set, skip nil check 2022-08-13 21:59:50 +01:00
1c826cb28d parser/gotest: Switch to output collector for active id tracking 2022-08-13 20:50:39 +01:00
83ca558534 parser/gotest: Return created id from CreateTest method 2022-08-13 20:50:39 +01:00
50c1179050 parser/gotest: Remove benchmark specific methods from reportBuilder 2022-08-13 20:50:39 +01:00
9d434fa4b4 parser/gotest: Implement active id tracking in output collector 2022-08-13 20:50:39 +01:00
d6bf22343d parser/gotest: Move event processing into reportBuilder 2022-08-13 20:48:36 +01:00
0fc43a220a internal/gojunitreport: Refactor testFileConfig to drop else block 2022-08-13 20:48:36 +01:00
ddf6b16828 Replace += 1 with ++ 2022-08-13 20:48:31 +01:00
fbfb33add1 junit: Use consistent receiver name 2022-08-13 20:47:42 +01:00
5616b5e921 Add missing godoc on exported types 2022-08-11 00:47:46 +01:00
066da07a49 Add go1.19 and remove go1.17 from workflow 2022-08-03 23:43:25 +01:00
d75fb6d4c3 parser/gotest: Remove unused runErrors field from reportBuilder 2022-07-20 14:29:24 +01:00
01f2cdde22 parser/gotest: Use the new LimitedLineReader in the gotest parser 2022-07-18 23:02:22 +01:00
3e3223a05b parser/gotest: Create LimitedLineReader 2022-07-18 22:38:36 +01:00
80a51f2ed0 parser/gotest: Move const declaration to top of file 2022-07-18 22:37:49 +01:00
3d712f2417 junit: Don't include File attribute when it's empty 2022-07-07 00:19:59 +01:00
03010d4a32 junit: Add File attribute to testsuite
Closes #113
2022-07-07 00:18:30 +01:00
88ec9224c5 Fix broken pkg.go.dev links in README 2022-07-02 22:00:11 +01:00
fca6708da0 Add v2.0.0 changelog to README 2022-07-02 14:21:31 +01:00