sincecutoff.com
← all changes

createTestHarness can evict running Durable Objects

Introduced 2026-07-15 · score 0.96

HOW TO USE IT

When testing recovery after a running Durable Object is torn down, call `worker.evictDurableObject(classNameOrBindingName, { name })` from a Wrangler test harness. It preserves durable storage and resets in-memory state on the next start.

const worker = server.getWorker(); await worker.evictDurableObject("Counter", { name: "user-123" });

WHY THIS HELPS

Test how a running Durable Object recovers after its instance is torn down.

BEFORE THIS CHANGE

The release note says this release adds Durable Object eviction support to `createTestHarness`; it does not specify an earlier workaround.

REQUIREMENTS AND LIMITATIONS

  • Version: 4.111.0
  • classNameOrBindingName (required): Exported Durable Object class name or binding name; class names resolve first.
  • options.name (required): Instance name; provide this or `id`.
  • options.id (required): Instance ID; provide this or `name`, but not both.
  • options.webSockets: Choose `"close"` or `"hibernate"` for WebSockets.
  • Prerequisite: Use Wrangler 4.111.0 or later; the release adds Durable Object eviction support to `createTestHarness`.
  • Prerequisite: Harness setup requires a Worker project with Wrangler configuration, a Node.js test runner, and Wrangler installed as a development dependency.

FIRST-PARTY EVIDENCE

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

Report a problem with this card