snippetcheck vs. test-snippets
test-snippets extracts code examples from markdown and executes them against the package installed locally. That's a meaningfully different, and in one real way stronger, guarantee than what snippetcheck does: a snippet that passes test-snippets actually ran, with real inputs, and produced real output. Type-checking can't promise that — it only promises the shapes line up. A function that compiles clean but throws at runtime, returns the wrong value, or depends on an environment variable nobody set is invisible to snippetcheck and exactly what test-snippets is built to catch.
The trade-off is what it takes to get there. Every snippet test-snippets runs has to be hand-tagged with an HTML comment before it will execute, which means it only works on docs you already control and have already annotated. It also needs API keys, network access, and a working runtime environment for whatever the snippet actually does — reasonable requirements for a maintainer testing their own docs before publishing, and requirements snippetcheck was specifically built to avoid.
| test-snippets | snippetcheck | |
|---|---|---|
| What it checks | Runtime behavior — does it run, what does it return | Type shape — does it still compile against published declarations |
| Setup required | Hand-tag every snippet, API keys, a working runtime environment | None — point it at a URL or file glob |
| Can run against someone else's docs | No — needs the docs repo, tagged, with credentials configured | Yes — reads published docs and installs the published package |
| Catches a genuine runtime bug in otherwise well-typed code | Yes | No |
| Catches a stale export/property/option after a version bump | Only if that snippet is tagged and its environment still works | Yes |
The honest way to put it: test-snippets tests the docs you've prepared; snippetcheck tests the docs you've already shipped. Both are opt-in tools for maintainers, but snippetcheck is zero-config specifically so it can also be pointed at a stranger's published documentation with no cooperation from them — it type-checks against real published declarations instead of executing against a live setup, so it needs no tagging, no credentials, and no environment beyond what npm install already requires. If you maintain the docs yourself and can invest in tagging and a working execution environment, test-snippets' runtime guarantee is strictly stronger than anything type-checking can offer.
See how snippetcheck works for the full methodology.