onsi/ginkgo

Specs aren't identified in `go test . -json` output

jamesrom opened this issue · 3 comments

Running go test . -json does not produce usable output when using Ginkgo. To be fully compatible with standard go tooling, producing test events that conform to the test2json spec would be necessary.

In particular, populating the Test field with not just the name of the function that ran the specs, but the name of the specs in the form form "Suite/Context/Spec/Etc".

ansd commented

Maybe, it's worth to implement a streaming JSON reporter in Ginkgo which would conform with the test2json spec.
A streaming JSON reporter has already been suggested in #143 (comment).

I could give it a try. What do you think @onsi ?

onsi commented

I'm going to be implementing the ability to emit a json test report in V2. I'll look into go test's output to see if it's a good fit but i expect i'll be producing a ginkgo specific format.

onsi commented

A beta for Ginkgo V2 was just released. It supports emitting JSON-formatted reports though, as mentioned above, it's Ginkgo's own JSON format which includes a bunch of rich test information.

Please try out the beta!