Files
Bartek Iwańczuk 2ac9a901c2 feat(test): built-in snapshot testing via t.assertSnapshot (#35139)
Adds snapshot testing to the built-in test runner: a new
`t.assertSnapshot(actual, options?)` method on `Deno.TestContext` and an
`--update-snapshots` (`-u`) flag for `deno test`. Snapshots are stored
in the same `__snapshots__/<test file>.snap` format as
`@std/testing/snapshot` (same serializer settings), so existing snapshot files keep working
after switching to the built-in API.

Compared to the userland implementation, update mode is a proper CLI
flag instead of `deno test -- --update`, and no read or write permissions are
needed for snapshot files in the default location since the runner
manages them itself (custom `dir`/`path` locations still require permissions,
and snapshot writes are only authorized when `--update-snapshots` is
passed).
Updated and removed snapshot counts are reported through the test
reporters in the run summary. Stale snapshots are only removed when every test in
a module ran all of its assertions, so filtered, ignored, `only` and
failed runs never delete snapshots they didn't see.

Out of scope for this PR, noted as follow-ups: inline snapshots
(`assertInlineSnapshot`), `expect(...).toMatchSnapshot()` on top of the
same machinery, Jest-style CI behavior (failing on newly written snapshots in
CI), and a deprecation pointer in `@std/testing/snapshot` once this
ships.
2026-06-20 21:31:54 +02:00
..
2026-01-08 16:28:43 +01:00
2026-01-08 16:28:43 +01:00