Open afbjorklund opened 1 year ago
When GOTESTSUM_ELAPSED
and GOTESTSUM_JSONFILE
are picked up automatically, the invocation becomes just:
gotestsum --jsonfile test_report.json --post-run-command "go-test-report --output test_report.html"
@afbjorklund I saw the following PR :https://github.com/vakenbolt/go-test-report/pull/62, that will allow users to specify the path to the test2json file produced by gotestsum, which is great! Currently I am running the invocation you shared above, which is dependent on the env vars being set, but I am still getting:
Error: ERROR: missing ≪ stdin ≫ pipe
.
GOTESTSUM_JSONFILE I am manually setting before execution GOTESTSUM_ELAPSED is set by gotestsum itself.
You should not have to set GOTESTSUM_JSONFILE, it should be exported by gotestsum
when you use the --jsonfile
parameter. There was a small change needed to the GOTESTSUM_ELAPSED variable, to add the "s" (for seconds)
$ gotestsum --jsonfile test_report.json --post-run-command env | grep GOTESTSUM
GOTESTSUM_JSONFILE=test_report.json
GOTESTSUM_JSONFILE_TIMING_EVENTS=
GOTESTSUM_JUNITFILE=
GOTESTSUM_ELAPSED=0.208s
Then what I did is to add two new parameters to go-test-report
, and have them default to these environment variables. You can also specify them explicitly, like go-test-report -i test_report.json -e 0.208s
, if not using post-run
$ go-test-report -i test_report.json -e 0.208s
[go-test-report] finished in 81.253371ms
$ grep Duration: test_report.html
<span class="total"><span class="indicator">⧉</span> Total: <strong>18</strong>Duration: <strong>208ms</strong>
@afbjorklund That is true, it is one or the other. I currently don't see any references to the GOTESTSUM_JSONFILE env var in master, which is likely why I am getting the stdin pipe error, unless I missed it while reviewing the code. Is that dependent on https://github.com/vakenbolt/go-test-report/pull/62 getting merged ?
You can do something like sh -c "go-test-report <$GOTESTSUM_JSONFILE"
(or just hardcode the file), until it is...
The only missing features are the testExecutionDate and the Duration, as mentioned.
I think we want to the name the file something other than "test_report.json"
Since it allows both progress and json, at the same time (not either / or).
It also has a default format that is more friendly on the eyes than
go test
.https://github.com/gotestyourself/gotestsum
Main issue is recording the current date and execution time "somewhere"...
21
Duration
(should be the test execution time, not the report execution time)testExecutionDate
(should be the test executation date, not the current date)