Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help command #211

Merged
merged 2 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ stdout and stderr output:

* The stdout produced by the script must only contain the `test2json` output, or
`gotestsum` will fail. If it isn't possible to change the script to avoid
non-JSON output, you can use `--ignore-non-json-output-lines` to ignore
non-JSON lines and write them to `gotestsum`'s stderr instead.
non-JSON output, you can use `--ignore-non-json-output-lines` (added in version 1.7.0)
to ignore non-JSON lines and write them to `gotestsum`'s stderr instead.
* Any stderr produced by the script will be considered an error (this behaviour
is necessary because package build errors are only reported by writting to
stderr, not the `test2json` stdout). Any stderr produced by tests is not
Expand Down Expand Up @@ -334,15 +334,19 @@ directory will be watched. Use the `--packages` flag to specify a different list
While in watch mode, pressing some keys will perform an action:

* `r` will run tests for the previous event.
Added in version 1.6.1.
* `d` will run tests for the previous event using `dlv test`, allowing you to
debug a test failure using [delve]. A breakpoint will automatically be added at
the first line of any tests which failed in the previous run. Additional
breakpoints can be added with [`runtime.Breakpoint`](https://golang.org/pkg/runtime/#Breakpoint)
or by using the delve command prompt.
Added in version 1.6.1.
* `a` will run tests for all packages, by using `./...` as the package selector.
Added in version 1.7.0.
* `l` will scan the directory list again, and if there are any new directories
which contain a file with a `.go` extension, they will be added to the watch
list.
Added in version 1.7.0.

Note that [delve] must be installed in order to use debug (`d`).

Expand Down
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Formats:

Commands:
tool tools for working with test2json output
help print this help next
`)
}

Expand Down
1 change: 1 addition & 0 deletions cmd/testdata/gotestsum-help-text
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Formats:

Commands:
tool tools for working with test2json output
help print this help next
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func route(args []string) error {
name := args[0]
next, rest := cmd.Next(args[1:])
switch next {
case "help", "?":
return cmd.Run(name, []string{"--help"})
case "tool":
return tool.Run(name+" "+next, rest)
default:
Expand Down