Rstest comes with a lightweight CLI that includes commands such as rstest watch and rstest run.
rstest -h
can help you view all available CLI commands and options:
The output is shown below:
Running rstest
directly will enable the Rstest test in the current directory. Listening mode is automatically entered in the development environment (equivalent to rstest watch
), while a single test is performed in the CI environment or non-terminal interactive mode (equivalent to rstest run
).
rstest run
will perform a single run, and the command is suitable for CI environments or scenarios where tests are not required to be performed while modifying.
rstest watch
will start listening mode and execute tests, and when the test or dependent file modifications, the associated test file will be re-execute.
rstest list
will print a test list of all matching conditions. By default, it prints the test names of all matching tests.
The rstest list
command inherits all rstest
filtering options, you can filter files directly or use -t
to filter the specified test name.
You can use --filesOnly
to make it print the test files only:
You can use --json
to make it print tests in JSON format in terminal or save the results to a separate file: