sincecutoff.com
← all changes

wrangler test helpers can disable persistence

Introduced 2026-03-13 · score 0.95

HOW TO USE IT

When tests need clean state on each run, set `persist: false` in `unstable_dev()` options or in the `dev` options passed to `unstable_startWorker()`.

const worker = await unstable_dev("./src/worker.ts", { persist: false });
const worker = await unstable_startWorker({ entrypoint: "./src/worker.ts", dev: { persist: false } });

WHY THIS HELPS

Run a Worker in tests that need a clean state on every run.

REQUIREMENTS AND LIMITATIONS

  • Version: 4.73.0
  • unstable_dev(script, options) — `script` (required): Worker script path, relative to the project root.
  • unstable_dev options — `persist`: Set to `false` to prevent binding data from being read from or written to the filesystem.
  • unstable_startWorker options — `entrypoint` (required): Worker entrypoint path, as shown in the v4.73.0 release example.
  • unstable_startWorker options — `dev.persist`: Set to `false` in the `dev` options to disable persistence.
  • Docs conflict: Current Wrangler API docs mark both unstable APIs as deprecated and recommend `createTestHarness()`; that is newer-version guidance and does not change the v4.73.0 release-note examples.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card