From 130fcaeccf04d0cba6dc69eb3bf25f6e3985db50 Mon Sep 17 00:00:00 2001 From: Asher Foa <1268088+asherf@users.noreply.github.com> Date: Sat, 7 Sep 2024 21:38:43 -0400 Subject: [PATCH 1/2] Run GHA workflow with newer go versions 1.22 & 1.23 --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 927559b..f985d6b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,7 +12,7 @@ jobs: test: strategy: matrix: - go-version: [ 1.19.x, 1.20.x, 1.21.x ] + go-version: [ 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x ] lint-and-coverage: [ false ] include: - go-version: 1.22.x From 455a6731ef351ed0adcac09c172c388bde911531 Mon Sep 17 00:00:00 2001 From: Asher Foa <1268088+asherf@users.noreply.github.com> Date: Sat, 7 Sep 2024 21:41:52 -0400 Subject: [PATCH 2/2] Set .suite property to the go package name fixes https://github.com/ctrf-io/go-ctrf-json-reporter/issues/4 --- README.md | 1 + reporter/reporter.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 8f4168d..7ccd6e5 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ The test object in the report includes the following [CTRF properties](https://c | Name | Type | Required | Details | | ---------- | ------ | -------- | ----------------------------------------------------------------------------------- | +| `suite` | String | Required | The name of go package containing the test. | | `name` | String | Required | The name of the test. | | `status` | String | Required | The outcome of the test. One of: `passed`, `failed`, `skipped`, `pending`, `other`. | | `duration` | Number | Required | The time taken for the test execution, in milliseconds. | diff --git a/reporter/reporter.go b/reporter/reporter.go index fcb580d..8fe15f5 100644 --- a/reporter/reporter.go +++ b/reporter/reporter.go @@ -47,6 +47,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R report.Results.Summary.Tests++ report.Results.Summary.Passed++ report.Results.Tests = append(report.Results.Tests, &ctrf.TestResult{ + Suite: event.Package, Name: event.Test, Status: ctrf.TestPassed, Duration: secondsToMillis(event.Elapsed), @@ -55,6 +56,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R report.Results.Summary.Tests++ report.Results.Summary.Failed++ report.Results.Tests = append(report.Results.Tests, &ctrf.TestResult{ + Suite: event.Package, Name: event.Test, Status: ctrf.TestFailed, Duration: secondsToMillis(event.Elapsed), @@ -63,6 +65,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R report.Results.Summary.Tests++ report.Results.Summary.Skipped++ report.Results.Tests = append(report.Results.Tests, &ctrf.TestResult{ + Suite: event.Package, Name: event.Test, Status: ctrf.TestSkipped, Duration: secondsToMillis(event.Elapsed),