Command-Line Options
In addition the command-line options for used to specify configuration
values described in the previous chapter,
maelstrom-go-test supports these command-line options:
| Option | Short Alias | Argument | Description |
|---|---|---|---|
--help | -h | print help and exit | |
--version | print version and exit | ||
--print-config | -P | print all configuration values and exit | |
--config-file | -c | path or - | file to read configuration values from |
--include | -i | pattern | include tests that match pattern |
--exclude | -x | pattern | exclude tests that match pattern |
--init | initialize test metadata file | ||
--watch | -w | loop running tests then waiting for changes | |
--list | alias for --list-tests | ||
--list-tests | -l | only list matching tests instead of running them | |
--list-packages | only list matching test packages instead of running tests |
--include and --exclude
The --include (-i) and --exclude (-x) command-line options control which tests
maelstrom-go-test runs or lists.
These options take a test filter pattern. The --include option
includes any test that matches the pattern. Similarly, --exclude pattern
excludes any test that matches the pattern. Both options are allowed to be
repeated arbitrarily.
The tests that are selected are the set which match any --include pattern but
don’t match any --exclude pattern. In other words, --excludes have precedence
over --includes, regardless of the order they are specified.
If no --include option is provided, maelstrom-go-test acts as if an
--include all option was provided.
--init
The --init command-line option is used to create a starter
maelstrom-go-test.toml file. See here for more
information.
--watch
The --watch command-line option causes maelstrom-go-test to run tests
repeatedly in a loop, waiting for changes to the project directory in between
runs. See here for more information.
--list-tests or --list
The --list-tests (or --list) command-line option causes maelstrom-go-test
to build all required test binaries, then print the tests that would normally
be run, without actually running them.
This option can be combined with --include and --exclude.
--list-packages
The --list-packages command-line option causes maelstrom-go-test to print
the packages from which it would potentially run tests, without actually
building any binaries or running any tests. This command may have to wait for
the go binary to download dependencies, however.
Because maelstrom-go-test won’t attempt to build the tests in the given
packages, it may include packages that don’t actually have any tests.
This option can be combined with --include and --exclude.
Abbreviations
As discussed here, unambiguous prefixes can be used
in patterns. This can come in handy when doing one-offs on the command line.
For example, to run all tests in package foo with a name that includes bar:
maelstrom-go-test -i 'p.eq(foo) & n.c(bar)'