Skip to content

Commit a69eb39

Browse files
committed
add support for GINKGO_TIME_FORMAT
1 parent e548367 commit a69eb39

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

docs/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -3446,8 +3446,11 @@ When you [filter specs](#filtering-specs) using Ginkgo's various filtering mecha
34463446
Here are a grab bag of other settings:
34473447

34483448
You can disable Ginkgo's color output by running `ginkgo --no-color` or setting the `GINKGO_NO_COLOR=TRUE` environment variable.
3449+
34493450
You can also output in a format that makes it easier to read in github actions console by running `ginkgo --github-output`.
34503451

3452+
You can change how Ginkgo formats timestamps in the timeline by setting `GINKGO_TIME_FORMAT` to a valid Golang time format layout (e.g. `GINKGO_TIME_FORMAT=02/01/06 3:04:05.00`).
3453+
34513454
By default, Ginkgo only emits full stack traces when a spec panics. When a normal assertion failure occurs, Ginkgo simply emits the line at which the failure occurred. You can, instead, have Ginkgo always emit the full stack trace by running `ginkgo --trace`.
34523455

34533456
### Reporting Infrastructure

types/types.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ package types
33
import (
44
"encoding/json"
55
"fmt"
6+
"os"
67
"sort"
78
"strings"
89
"time"
910
)
1011

1112
const GINKGO_FOCUS_EXIT_CODE = 197
12-
const GINKGO_TIME_FORMAT = "01/02/06 15:04:05.999"
13+
14+
var GINKGO_TIME_FORMAT = "01/02/06 15:04:05.999"
15+
16+
func init() {
17+
if os.Getenv("GINKGO_TIME_FORMAT") != "" {
18+
GINKGO_TIME_FORMAT = os.Getenv("GINKGO_TIME_FORMAT")
19+
}
20+
}
1321

1422
// Report captures information about a Ginkgo test run
1523
type Report struct {

0 commit comments

Comments
 (0)