Code Block Tags¶
Tagging Blocks as Tests¶
Tag your fenced code blocks with test or should to mark them as tests:
Only tagged blocks are executed by default. Untagged blocks are ignored, so you can have plain examples alongside test blocks.
Supported Languages¶
readme-assert supports javascript, js, typescript, and ts code blocks.
TypeScript type annotations are stripped automatically before execution.
Grouping Blocks¶
Each code block runs as its own file. To share variables across blocks, give them the same group name:
Blocks with the same group name are concatenated and run as a single module. Blocks without a group name each run independently.
Auto-Discover Mode¶
With --auto, any code block containing //=>, // →, or // throws
is treated as a test — no test tag needed:
All Mode¶
With --all, every JavaScript and TypeScript code block is executed,
regardless of tags: