Skip to content

CLI Reference

Usage

bash
mdspec [options] <patterns...>

patterns can be file paths or glob patterns (e.g., tests/**/*.spec.md).

Options

FlagDescriptionDefault
-u, --updateUpdate snapshots (replace expected output with actual)false
--hide-bodyHide markdown body text in outputfalse
--no-truncDisable truncation of long linestruncate at 70 chars
--dotsDots reporter -- dots for passing, details for failuresfalse
--tapTAP reporter -- output Test Anything Protocol formatfalse
-V, --versionShow version number
-h, --helpShow help

Examples

bash
# Single file
mdspec tests/example.spec.md

# Multiple files with glob
mdspec tests/**/*.spec.md

# Update snapshots
mdspec --update tests/**/*.spec.md

# Minimal output
mdspec --dots tests/**/*.spec.md

# CI-friendly TAP output
mdspec --tap tests/**/*.spec.md

Reporters

Default (markdown)

Prints results as formatted markdown with headings from the test document, pass/fail indicators, and colored diffs for failures.

Dots (--dots)

Prints a . for each passing test, with full details only on failure. Compact output for large test suites.

TAP (--tap)

Outputs Test Anything Protocol format for integration with TAP consumers.

Debug Namespaces

Enable with the DEBUG environment variable using the debug package:

bash
DEBUG='mdspec:*' mdspec tests/example.spec.md       # All debug output
DEBUG='mdspec:runner' mdspec tests/example.spec.md   # Test execution only
DEBUG='mdspec:files' mdspec tests/example.spec.md    # File creation only
DEBUG='mdspec:session' mdspec tests/example.spec.md  # Session state only
NamespaceWhat it shows
mdspec:runnerTest file discovery, parsing, and execution
mdspec:filesHelper file creation from file= blocks
mdspec:sessionSession state management (env, cwd, functions)

Exit Codes

CodeMeaning
0All tests passed
1One or more tests failed
2No test files found