From f20fd5f9cdfaa4c657a211c6efa97c25ad6a21b8 Mon Sep 17 00:00:00 2001 From: mloo3 Date: Fri, 19 May 2023 16:23:06 -0700 Subject: [PATCH 1/3] collect duration after recover --- runner.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runner.go b/runner.go index 12d27da..aead64d 100644 --- a/runner.go +++ b/runner.go @@ -85,6 +85,7 @@ func (r *testRunner) executeIteration(ctx context.Context, currTest testRun, res var data interface{} var td TearDownFunction var err error + var start time.Time buf := &bytes.Buffer{} @@ -102,6 +103,7 @@ func (r *testRunner) executeIteration(ctx context.Context, currTest testRun, res // recover remote code. r := recover() + ti.duration = time.Since(start) if r == nil { return } @@ -144,9 +146,8 @@ func (r *testRunner) executeIteration(ctx context.Context, currTest testRun, res }() } - start := time.Now() + start = time.Now() ti.err = t.test.Function(ctx, subTestInfo) - ti.duration = time.Since(start) }(currTest, i) } From 8ccdf23c18b3858a3dd3c096c32c1cf9f3dfaec9 Mon Sep 17 00:00:00 2001 From: mloo3 Date: Fri, 19 May 2023 17:17:00 -0700 Subject: [PATCH 2/3] lint fix --- printer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/printer.go b/printer.go index f02979d..1929a0d 100644 --- a/printer.go +++ b/printer.go @@ -23,8 +23,9 @@ func printSetupError(id, suite, name string, recovery interface{}, err error) { fmt.Printf("%s\n", goterm.Bold( goterm.Color( - fmt.Sprintf("%s FAIL %s", + fmt.Sprintf("%s: %s FAIL %s", id, + suite, name, ), goterm.YELLOW, From 65949fa90148af97616e22b0d1cc938db7162368 Mon Sep 17 00:00:00 2001 From: mloo3 Date: Fri, 19 May 2023 17:23:06 -0700 Subject: [PATCH 3/3] latest golangci-lint does not work with go 1.18 --- .github/workflows/build-go.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-go.yaml b/.github/workflows/build-go.yaml index 1973919..1596e25 100644 --- a/.github/workflows/build-go.yaml +++ b/.github/workflows/build-go.yaml @@ -37,14 +37,14 @@ jobs: go install github.com/AlekSi/gocov-xml@latest - name: setup-for-older-go - if: ${{ matrix.go <= 1.17 }} + if: ${{ matrix.go <= 1.18 }} run: | # stay on an older version of golangci-lint which still builds against 1.17 # This is due to the introduction of generics. go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3 - name: setup-for-newer-go - if: ${{ matrix.go > 1.17 }} + if: ${{ matrix.go > 1.18 }} run: | go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest