docs/src/cli/test.md
tree-sitter testThe test command is used to run the test suite for a parser.
tree-sitter test [OPTIONS] # Aliases: t
-i/--include <INCLUDE>Only run tests whose names match this regex.
-e/--exclude <EXCLUDE>Skip tests whose names match this regex.
--file-name <NAME>Only run tests from the given filename in the corpus.
-p/--grammar-path <PATH>The path to the directory containing the grammar.
--lib-pathThe path to the parser's dynamic library. This is used instead of the cached or automatically generated dynamic library.
--lang-nameIf --lib-path is used, the name of the language used to extract the library's language function
-u/--updateUpdate the expected output of tests.
Tests containing `ERROR` nodes or `MISSING` nodes will not be updated.
-d/--debugOutputs parsing and lexing logs. This logs to stderr.
-0/--debug-buildCompile the parser with debug flags enabled. This is useful when debugging issues that require a debugger like gdb or lldb.
-D/--debug-graphOutputs logs of the graphs of the stack and parse trees during parsing, as well as the actual parsing and lexing message.
The graphs are constructed with [graphviz dot][dot], and the output is written to log.html.
--wasmCompile and run the parser as a Wasm module (only if the tree-sitter CLI was built with --features=wasm).
--open-logWhen using the --debug-graph option, open the log file in the default browser.
--config-path <CONFIG_PATH>The path to an alternative configuration (config.json) file. See the init-config command for more information.
--show-fieldsForce showing fields in test diffs.
--stat <STAT>Show parsing statistics when tests are being run. One of all, outliers-and-total, or total-only.
all: Show statistics for every test.
outliers-and-total: Show statistics only for outliers, and total statistics.
total-only: Show only total statistics.
-r/--rebuildForce a rebuild of the parser before running tests.
--overview-onlyOnly show the overview of the test results, and not the diff.
--json-summaryOutput the test summary in a JSON format.