---
title: Test Durable Object eviction with new cloudflare:test helpers
description: evictDurableObject and evictAllDurableObjects let you test how Durable Objects behave across evictions in your Vitest tests.
image: https://developers.cloudflare.com/changelog-preview.png
---

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/changelog/llms.txt  
> Use this file to discover all available pages before exploring further. 

[Skip to content](#%5Ftop) 

# Changelog

New updates and improvements at Cloudflare.

[ Subscribe to RSS ](https://developers.cloudflare.com/changelog/rss/index.xml) [ View RSS feeds ](https://developers.cloudflare.com/fundamentals/new-features/available-rss-feeds/) 

![hero image](https://developers.cloudflare.com/_astro/hero.CVYJHPAd_26AMqX.svg) 

[ ← Back to all posts ](https://developers.cloudflare.com/changelog/) 

## Test Durable Object eviction with new cloudflare:test helpers

Jun 25, 2026 

[ Durable Objects ](https://developers.cloudflare.com/durable-objects/)[ Workers ](https://developers.cloudflare.com/workers/) 

The `@cloudflare/vitest-pool-workers` package now includes `evictDurableObject` and `evictAllDurableObjects` test helpers, exported from `cloudflare:test`.

These helpers let you test how a Durable Object behaves across evictions, simulating the production lifecycle where an idle Durable Object can be evicted from memory.

For more context, refer to [Lifecycle of a Durable Object](https://developers.cloudflare.com/durable-objects/concepts/durable-object-lifecycle/).

TypeScript

```
import { evictDurableObject, evictAllDurableObjects } from "cloudflare:test";import { env } from "cloudflare:workers";
const id = env.COUNTER.idFromName("my-counter");const stub = env.COUNTER.get(id);
// Evict the Durable Object instance pointed to by a specific stubawait evictDurableObject(stub);
// Close WebSockets instead of hibernating themawait evictDurableObject(stub, { webSockets: "close" });
// Evict all currently-running Durable Objects in evictable namespacesawait evictAllDurableObjects();
```

These helpers are available in `@cloudflare/vitest-pool-workers@0.16.20` and later.

Learn more in the [Test APIs reference](https://developers.cloudflare.com/workers/testing/vitest-integration/test-apis/#durable-objects) and the [Testing Durable Objects guide](https://developers.cloudflare.com/durable-objects/examples/testing-with-durable-objects/#testing-eviction).

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://developers.cloudflare.com/changelog/post/2026-06-25-durable-object-eviction-test-helpers/#page","headline":"Test Durable Object eviction with new cloudflare:test helpers · Changelog","description":"evictDurableObject and evictAllDurableObjects let you test how Durable Objects behave across evictions in your Vitest tests.","url":"https://developers.cloudflare.com/changelog/post/2026-06-25-durable-object-eviction-test-helpers/","inLanguage":"en","image":"https://developers.cloudflare.com/changelog-preview.png","dateModified":"2026-06-25","datePublished":"2026-06-25","publisher":{"@type":"Organization","name":"Cloudflare","url":"https://www.cloudflare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
