{"id":11400580,"name":"cmd/test2json","ecosystem":"go","description":"Test2json converts go test output to a machine-readable JSON stream.\n\nUsage:\n\nTest2json runs the given test command and converts its output to JSON;\nwith no command specified, test2json expects test output on standard input.\nIt writes a corresponding stream of JSON events to standard output.\nThere is no unnecessary input or output buffering, so that\nthe JSON stream can be read for “live updates” of test status.\n\nThe -p flag sets the package reported in each test event.\n\nThe -t flag requests that time stamps be added to each test event.\n\nThe test should be invoked with -test.v=test2json. Using only -test.v\n(or -test.v=true) is permissible but produces lower fidelity results.\n\nNote that \"go test -json\" takes care of invoking test2json correctly,\nso \"go tool test2json\" is only needed when a test binary is being run\nseparately from \"go test\". Use \"go test -json\" whenever possible.\n\nNote also that test2json is only intended for converting a single test\nbinary's output. To convert the output of a \"go test\" command that\nruns multiple packages, again use \"go test -json\".\n\nThe JSON stream is a newline-separated sequence of TestEvent objects\ncorresponding to the Go struct:\n\nThe Time field holds the time the event happened.\nIt is conventionally omitted for cached test results.\n\nThe Action field is one of a fixed set of action descriptions:\n\nEvery JSON stream begins with a \"start\" event.\n\nThe Package field, if present, specifies the package being tested.\nWhen the go command runs parallel tests in -json mode, events from\ndifferent tests are interlaced; the Package field allows readers to\nseparate them.\n\nThe Test field, if present, specifies the test, example, or benchmark\nfunction that caused the event. Events for the overall package test\ndo not set Test.\n\nThe Elapsed field is set for \"pass\" and \"fail\" events. It gives the time\nelapsed for the specific test or the overall package test that passed or failed.\n\nThe Output field is set for Action == \"output\" and is a portion of the test's output\n(standard output and standard error merged together). The output is\nunmodified except that invalid UTF-8 output from a test is coerced\ninto valid UTF-8 by use of replacement characters. With that one exception,\nthe concatenation of the Output fields of all output events is the exact\noutput of the test execution.\n\nThe FailedBuild field is set for Action == \"fail\" if the test failure was\ncaused by a build failure. It contains the package ID of the package that\nfailed to build. This matches the ImportPath field of the \"go list\" output,\nas well as the BuildEvent.ImportPath field as emitted by \"go build -json\".\n\nWhen a benchmark runs, it typically produces a single line of output\ngiving timing results. That line is reported in an event with Action == \"output\"\nand no Test field. If a benchmark logs output or reports a failure\n(for example, by using b.Log or b.Error), that extra output is reported\nas a sequence of events with Test set to the benchmark name, terminated\nby a final event with Action == \"bench\" or \"fail\".\nBenchmarks have no events with Action == \"pause\".","homepage":"https://cs.opensource.google/go/go","licenses":"BSD-3-Clause","normalized_licenses":["BSD-3-Clause"],"repository_url":"https://cs.opensource.google/go/go","keywords_array":[],"namespace":"cmd","versions_count":50,"first_release_published_at":"2026-02-22T09:08:29.596Z","latest_release_published_at":"2026-02-22T09:08:29.596Z","latest_release_number":"go1.21.13","last_synced_at":"2026-07-09T06:17:42.985Z","created_at":"2025-03-03T21:53:01.559Z","updated_at":"2026-10-03T08:26:06.183Z","registry_url":"https://pkg.go.dev/cmd/test2json","install_command":"go get cmd/test2json","documentation_url":"https://pkg.go.dev/cmd/test2json#section-documentation","metadata":{},"repo_metadata":{},"repo_metadata_updated_at":"2026-10-03T08:26:06.179Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":6.084953491875412,"dependent_packages_count":5.702990755173129,"stargazers_count":null,"forks_count":null,"docker_downloads_count":null,"average":5.893972123524271},"purl":"pkg:golang/cmd/test2json","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/go/cmd/test2json","docker_dependents_count":4273,"docker_downloads_count":2386097494,"usage_url":"https://repos.ecosyste.ms/usage/go/cmd/test2json","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/go/cmd/test2json/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/cmd%2Ftest2json/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/cmd%2Ftest2json/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/cmd%2Ftest2json/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/cmd%2Ftest2json/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/cmd%2Ftest2json/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/cmd%2Ftest2json/codemeta","maintainers":[]}