Skip to content

CLI

The binary is available as both ast and as-test. Use npx ast <command> (or add scripts to package.json).

bash
ast --version
ast --help
ast <command> --help

Commands

CommandPurpose
ast testBuild, then run specs. The everyday command.
ast runRun already-built artifacts (skip the build).
ast buildCompile specs to wasm without running.
ast fuzzBuild and run fuzz targets.
ast initScaffold config, runners, and example specs.
ast doctorValidate config, dependencies, and runtime.
ast cleanRemove build outputs, logs, coverage, and crashes.

test builds and runs in one step; run expects artifacts to already exist (useful after a separate build). See Getting Started to scaffold a project.

Common examples

bash
ast test                       # build + run every spec
ast test math                  # the spec named "math"
ast test --parallel            # spread files across workers
ast test --watch               # re-run on change
ast test --mode node:bindings  # run a specific mode
ast test --fuzz                # specs, then fuzzers
ast test --show-coverage       # print uncovered points
ast fuzz --seed 1337           # reproducible fuzz campaign

Shared flags

Available on most run-like commands (test, run, fuzz, build, doctor, clean as noted):

FlagApplies toEffect
--mode <names>allRun one or more named modes (comma-separated).
--config <path>allUse a specific config file.
--enable <list>build/run/testEnable features (e.g. coverage, try-as).
--disable <list>build/run/testDisable features.
--jobs <n>build/run/test/fuzzRun files through an ordered worker pool of size n.
--build-jobs <n>build/run/test/fuzzCap concurrent builds (defaults to --jobs).
--run-jobs <n>run/test/fuzzCap concurrent runs (defaults to --jobs).
--listbuild/run/test/fuzzPreview resolved files/artifacts without executing.
--list-modesbuild/run/test/fuzzPreview configured and selected mode names.

ast test and ast run

test accepts everything run does, plus the build and fuzz options below.

FlagEffect
--parallelRun files through a worker pool sized automatically.
--browser <name|path>Browser for web modes: chrome, chromium, firefox, webkit, or a path.
--create-snapshotsRecord snapshots that don't exist yet.
--overwrite-snapshotsRe-baseline snapshots on mismatch.
--no-snapshotSkip snapshot assertions for this run.
--show-coverage[=all]Print uncovered coverage points; =all expands nested gaps.
--suite <names>Filter to matching suite names or slug paths (alias --suites).
--reporter <name|path>Use default, tap, or a custom reporter module.
--tapShortcut for --reporter tap.
--verboseKeep expanded per-suite/test lines and live updates.
--cleanDisable in-place TTY updates; print final lines only.

Fuzz options (on ast test)

FlagEffect
--fuzzRun fuzz targets after the test pass.
--fuzz-runs <value>Override iteration count (500, 1.5x, +10%, +100000).
--fuzz-seed <n>Pin the fuzz base seed.

Watch mode

ast test --watch (or -w) re-runs on source or spec changes and exposes interactive keys:

KeyAction
wToggle auto-run / manual mode.
space / enterRetry failing specs.
aRe-run all specs.
ctrl+cStop.

ast fuzz

FlagEffect
--runs <value>Override iteration count (500, 1.5x, +10%, +100000).
--seed <n>Pin the base seed.
--fuzzer <names>Filter to matching targets (aliases --fuzzers, --suite, --suites).

See Running Fuzzers.

ast init

FlagEffect
--target <wasi|bindings|web>Build target.
--example <minimal|full|none>Example spec template.
--fuzz-example / --no-fuzz-exampleInclude or omit the sample fuzzer.
--enable <list> / --disable <list>Toggle features at scaffold time.
--installInstall dependencies afterward.
--dir <path>Target directory.
--yes, -yNon-interactive defaults.
--forceOverwrite managed files.

ast doctor and ast clean

Both take --config and --mode. doctor validates the project (Doctor); clean removes configured outputs and, with no --mode, cleans every configured mode.

Selectors

A positional argument selects which files run; --suite filters which suites run within them by name or slug path.

Selectors resolve against your configured input root(s) — the static prefix of each input glob, e.g. assembly/__tests__ — searched recursively, and fall back to the current directory if nothing matched there.

You typeResolves to
foo<root>/**/foo.spec.ts (a spec by name)
rfc/<root>/**/rfc/**/*.spec.ts (every spec under a folder)
rfc/*.spec.ts<root>/**/rfc/*.spec.ts (your glob, anchored to the test folder)
*.spec.tsevery spec under the root
./rfc/*.spec.tsmatched from the current directory only (leading ./, /, or ~)
a,btwo selectors, a and b
bash
ast test expectation                             # the spec named "expectation"
ast test rfc/                                     # every spec under an rfc/ folder
ast test 'rfc/*.spec.ts'                          # quote globs so the shell doesn't expand them
ast run expectation --suite "expectations/toBe"   # one suite by slug
ast fuzz --fuzzer "addition"                      # fuzz targets by name

Notes:

  • A selector that matches nothing prints a WARN naming where it looked; a ./-prefixed miss suggests the test-folder form (did you mean "rfc/*.spec.ts").
  • A bare selector that matches under more than one configured input root prints a WARN and runs all of them.
  • Selectors intentionally bypass !-negations in input, so an explicit pick always wins.
  • Use --list to preview what a selector resolves to without running anything.

Web modes

Web runs need a browser. Set it per mode (runtime.browser) or with --browser, and add --headless to the runner command for CI:

bash
ast test --mode chromium:headless
ast test --mode firefox --browser /path/to/firefox