Repository navigation
Proposal: deprecate @std/testing/bdd and @std/testing/snapshot in favor of built-ins #7208
Description
Summary
We propose deprecating the @std/testing/bdd and @std/testing/snapshot exports (plus @std/testing/unstable-bdd) in favor of functionality that is now built into the Deno test runner and the node:test module. The @std/testing/mock, @std/testing/time, and @std/testing/types exports are not affected.
Motivation
Both modules now have first-class equivalents in the runtime:
- Snapshots: Deno 2.9 added a built-in
t.assertSnapshot()on the test context (blog post). It uses the same file format and serializer as@std/testing/snapshot, so existing__snapshots__/*.snapfiles keep working. It supportsserializer,name,dir/path, andmodeoptions, and snapshots are updated withdeno test --update-snapshots(-u), which also prunes stale entries.node:testadditionally providest.assert.snapshot()andt.assert.fileSnapshot()for code that also runs on Node.js. - BDD:
node:test'sdescribe/it/test(including.only,.skip,.todoand thebefore/beforeEach/after/afterEachhooks) are supported first-class bydeno test. For the flat style,Deno.testgainedDeno.test.beforeAll/beforeEach/afterEach/afterAllhooks in Deno 2.5 andDeno.test.each()in Deno 2.9.
Keeping userland duplicates of built-in functionality adds maintenance burden and splits the ecosystem, so we'd like to point users at the built-ins going forward.
Migration
@std/testing API |
Replacement | Since |
|---|---|---|
assertSnapshot(t, value, opts) |
await t.assertSnapshot(value, opts) |
Deno 2.9 |
createAssertSnapshot(opts) |
pass options to t.assertSnapshot() (or wrap it) |
Deno 2.9 |
describe / it / test + hooks |
node:test describe / it / test + hooks |
Deno 1.36+ |
it.only / it.skip / it.ignore |
node:test it.only / it.skip |
— |
describe.todo / it.todo / test.todo (unstable-bdd) |
node:test .todo variants |
— |
| flat-style hooks | Deno.test.beforeAll / beforeEach / afterEach / afterAll |
Deno 2.5 |
configureGlobalSanitizers (unstable-bdd) |
no direct equivalent; set sanitizer options per test via Deno.test options |
— |
Known gap: describe(...) accepts Deno.test options (sanitizeOps, sanitizeResources, permissions, ...) per suite; node:test suites don't. Code relying on per-suite options can migrate to the flat Deno.test style instead. The module docs will cover this.
Not (yet) included: @std/testing/unstable-snapshot
assertInlineSnapshot() has no built-in equivalent: neither the Deno test runner nor node:test supports inline snapshots today (upstream feature request: nodejs/node#59231). We'll hold off deprecating this export until an inline-snapshot built-in exists.
Plan
- Land deprecation PRs (
deprecation(testing): snapshot,deprecation(testing): bdd) adding@deprecatedJSDoc tags to all affected exported symbols, with removal slated for@std/testing@2.0.0, and rewriting the module docs into migration guides. - Migrate internal usage in this repo (
expectdocs/tests, tooling) to the built-ins. - Update the docs.deno.com tutorials that currently teach
@std/testing/bddand@std/testing/snapshotto teach the built-ins instead. - At a later, yet-undecided point, release
@std/testing@2.0.0with the deprecated exports removed. The deprecated APIs keep working for the entire 1.x line.
Feedback welcome — especially if you rely on APIs from these modules that the built-ins don't cover.
Activity
lowlighter commentedon Jul 4, 2026
It's not directly related to the
@std/testingpackage, but here's minor inconveniences I have with the current builtinDeno.test:bartlomieju commentedon Jul 6, 2026
@lowlighter can you open an issue in Deno repo for these?
tomas-zijdemans commentedon Jul 7, 2026
I support this