gotest.tools/gotestsum@v1.11.0/cmd/tool/slowest/testdata/cmd-flags-help-text (about) 1 Usage: 2 gotestsum tool slowest [flags] 3 4 Read a json file and print or update tests which are slower than threshold. 5 The json file may be created with 'gotestsum --jsonfile' or 'go test -json'. 6 If a TestCase appears more than once in the json file, it will only appear once 7 in the output, and the median value of all the elapsed times will be used. 8 9 By default this command will print the list of tests slower than threshold to stdout. 10 The list will be sorted from slowest to fastest. 11 12 If --skip-stmt is set, instead of printing the list to stdout, the AST for the 13 Go source code in the working directory tree will be modified. The value of 14 --skip-stmt will be added to Go test files as the first statement in all the test 15 functions which are slower than threshold. 16 17 The --skip-stmt flag may be set to the name of a predefined statement, or to 18 Go source code which will be parsed as a go/ast.Stmt. Currently there is only one 19 predefined statement, --skip-stmt=testing.Short, which uses this Go statement: 20 21 if testing.Short() { 22 t.Skip("too slow for testing.Short") 23 } 24 25 26 Alternatively, a custom --skip-stmt may be provided as a string: 27 28 skip_stmt=' 29 if os.GetEnv("TEST_FAST") != "" { 30 t.Skip("too slow for TEST_FAST") 31 } 32 ' 33 go test -json -short ./... | gotestsum tool slowest --skip-stmt "$skip_stmt" 34 35 Note that this tool does not add imports, so using a custom statement may require 36 you to add imports to the file. 37 38 Go build flags, such as build tags, may be set using the GOFLAGS environment 39 variable, following the same rules as the go toolchain. See 40 https://golang.org/cmd/go/#hdr-Environment_variables. 41 42 Flags: 43 --debug enable debug logging. 44 --jsonfile string path to test2json output, defaults to stdin 45 --num int print at most num slowest tests, instead of all tests above the threshold 46 --skip-stmt string add this go statement to slow tests, instead of printing the list of slow tests 47 --threshold duration test cases with elapsed time greater than threshold are slow tests (default 100ms)