TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tree-sitter/tree-sitter/llms.txt
Use this file to discover all available pages before exploring further.
test command runs the test suite for a parser. It validates corpus tests, query validity, syntax highlighting tests, and tag tests.
t
Test Types
The command runs several types of tests:Corpus Tests
Located intest/corpus/, these tests verify that the parser produces the expected syntax trees for various inputs.
Query Tests
Validates that all queries in thequeries/ directory are syntactically correct and work with the parser.
Highlight Tests
Located intest/highlight/, these tests verify syntax highlighting produces expected results.
Tag Tests
Located intest/tags/, these tests verify symbol tagging produces expected tags.
Options
Test Selection
Only run tests whose names match this regex.
Skip tests whose names match this regex.
Only run tests from the given filename in the corpus.
Parser Options
The path to the directory containing the grammar. Implies
--rebuild.The path to the parser’s dynamic library. Used instead of the cached or automatically generated library.
If
--lib-path is used, the name of the language used to extract the library’s language function.Test Management
Update the expected output of tests.
Output Options
Only show the overview of test results, not the diff.
Force showing fields in test diffs.
Show parsing statistics when tests are being run. One of:
all- Show statistics for every testoutliers-and-total- Show statistics only for outliers and totaltotal-only- Show only total statistics
Output the test summary in a JSON format.
Debug Options
Output parsing and lexing logs to stderr.
Output logs of the graphs of the stack and parse trees. Graphs are constructed with graphviz dot, and output is written to
log.html.When using
--debug-graph, open the log file in the default browser.Compile the parser with debug flags enabled. Useful when debugging with
gdb or lldb.Build Options
Compile and run the parser as a Wasm module (only if the CLI was built with
--features=wasm).Force a rebuild of the parser before running tests.
The path to an alternative configuration (
config.json) file. See init-config.