@cloudflare/vitest-plugin
1.4.6 · 20 Oct 2026MIT624.2k / weekRepositoryHomepagenpmAtom feed
40 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 1.x · latest line
1.4.6
20 Oct 2026Dispose Workflow step results and introspection modifiers after use
Release RPC resources deterministically during local Workflow execution and introspection. This prevents undisposed RPC warnings and requests being cancelled after their execution context has ended. Live step results retain their original data shape, including typed-array offsets and backing buffers. Callbacks that finish after a step times out also release their results, cancelling unused streams without delaying retries.
Disposing an introspector still aborts the instance if modifier acquisition failed, without introducing a teardown error. Non-stream results containing function-valued array properties are rejected according to the serialisable-output contract, instead of silently discarding those properties during storage normalisation.
Fail with an error instead of hanging when local dev requests can't work under Bun
Bun's
fetch()ignores the undicidispatcherthat Miniflare routes requests through (oven-sh/bun#39247). Under Bun,createTestHarness()'sserver.fetch()andserver.getWorker()'sfetch(),email()andscheduled()now throw aUserError, requests to the dev server URL get a 503 naming the cause, and starting remote bindings throws aUserError. Each of these used to hang with no error.server.getWorker().getEnv()andgetExport()keep working under Bun.
Patch Changes
Dispose Workflow step results and introspection modifiers after use
Release RPC resources deterministically during local Workflow execution and introspection. This prevents undisposed RPC warnings and requests being cancelled after their execution context has ended. Live step results retain their original data shape, including typed-array offsets and backing buffers. Callbacks that finish after a step times out also release their results, cancelling unused streams without delaying retries.
Disposing an introspector still aborts the instance if modifier acquisition failed, without introducing a teardown error. Non-stream results containing function-valued array properties are rejected according to the serialisable-output contract, instead of silently discarding those properties during storage normalisation.
Fail with an error instead of hanging when local dev requests can't work under Bun
Bun's
fetch()ignores the undicidispatcherthat Miniflare routes requests through (oven-sh/bun#39247). Under Bun,createTestHarness()'sserver.fetch()andserver.getWorker()'sfetch(),email()andscheduled()now throw aUserError, requests to the dev server URL get a 503 naming the cause, and starting remote bindings throws aUserError. Each of these used to hang with no error.server.getWorker().getEnv()andgetExport()keep working under Bun.
1.4.5
19 Oct 2026Fix test runs slowing down file after file, and stalling, with
isolate: falseWith
isolate: false, Vitest hands a worker's module runner to the pool again for every test file the worker runs, and the pool wrapped the runner's module fetches in one more layer each time, so imports got slower with every file until runs stalled. The pool now patches each module runner once.
Patch Changes
Fix test runs slowing down file after file, and stalling, with
isolate: falseWith
isolate: false, Vitest hands a worker's module runner to the pool again for every test file the worker runs, and the pool wrapped the runner's module fetches in one more layer each time, so imports got slower with every file until runs stalled. The pool now patches each module runner once.
1.4.4
16 Oct 2026Only updates dependencies:miniflare 5.20261012.1-betawrangler 4.151.1
1.4.3
15 Oct 2026Fix V8 coverage failing with Vitest 5.0.4
Tests using V8 coverage with Vitest 5.0.4 no longer fail with an assertion error during teardown.
Fix Workers tests failing with Vitest's filesystem module cache
This supports Vitest 4.1's
test.experimental.fsModuleCacheand Vitest 5'stest.fsModuleCache.
1.4.1 – 1.4.22 releases that only update dependenciesminiflare 5.20261012.0-betawrangler 4.151.0Show each
1.4.0
8 Oct 2026Support V8 code coverage in the Workers Vitest integration
Vitest's default V8 coverage provider now collects and reports coverage for tests running locally in the Workers runtime.
Add support for Vitest 5
Minor Changes
Support V8 code coverage in the Workers Vitest integration
Vitest's default V8 coverage provider now collects and reports coverage for tests running locally in the Workers runtime.
Add support for Vitest 5
1.3.1 – 1.3.77 releases that only update dependencieswrangler 4.148.0miniflare 5.20261006.0-alphaShow each
- 1.3.76 Oct 2026wrangler 4.148.0miniflare 5.20261006.0-alpha
- 1.3.62 Oct 2026wrangler 4.147.0miniflare 5.20261001.0-alpha
- 1.3.51 Oct 2026wrangler 4.146.0miniflare 5.20261001.0-alpha
- 1.3.430 Sep 2026miniflare 5.20260930.0-alphawrangler 4.145.0
- 1.3.329 Sep 2026wrangler 4.144.0miniflare 5.20260926.1-alpha
- 1.3.229 Sep 2026wrangler 4.143.1miniflare 5.20260926.1-alpha
- 1.3.128 Sep 2026wrangler 4.143.0
1.3.0
27 Sep 2026Support Workflows declared in
exportsonctx.exportsin local developmentA Workflow declared in a Worker's
exportsis now available onctx.exportsinwrangler dev, the Vite plugin and the Vitest plugin, with the same API as a Workflow binding:const instance = await ctx.exports.MyWorkflow.create({ params: { name: "World" }, });ctx.exportsandworkflowsbindings with the same Workflownameshare their instances, including instances created before the Workflow was declared inexports. Two Workers can't export the same Workflow name, and a binding to an exported Workflow must refer to the Worker and class that export it.getPlatformProxy()ignores Workflows declared inexports, since it doesn't run the Worker's code.wrangler workflowscommands run with--localalso work with Workflows declared only inexports, without aworkflowsbinding.In the Vitest plugin,
introspectWorkflow()andintrospectWorkflowInstance()still need a Workflow binding, and now explain how to add one when passed a Workflow fromctx.exports. Instances created throughctx.exportsare introspected too. Aworkflowsbinding whosescript_nameis the Worker's own name now resolves to the Worker itself again.
Minor Changes
Support Workflows declared in
exportsonctx.exportsin local developmentA Workflow declared in a Worker's
exportsis now available onctx.exportsinwrangler dev, the Vite plugin and the Vitest plugin, with the same API as a Workflow binding:const instance = await ctx.exports.MyWorkflow.create({ params: { name: "World" }, });ctx.exportsandworkflowsbindings with the same Workflownameshare their instances, including instances created before the Workflow was declared inexports. Two Workers can't export the same Workflow name, and a binding to an exported Workflow must refer to the Worker and class that export it.getPlatformProxy()ignores Workflows declared inexports, since it doesn't run the Worker's code.wrangler workflowscommands run with--localalso work with Workflows declared only inexports, without aworkflowsbinding.In the Vitest plugin,
introspectWorkflow()andintrospectWorkflowInstance()still need a Workflow binding, and now explain how to add one when passed a Workflow fromctx.exports. Instances created throughctx.exportsare introspected too. Aworkflowsbinding whosescript_nameis the Worker's own name now resolves to the Worker itself again.
1.2.6 – 1.2.83 releases that only update dependenciesminiflare 5.20260925.0-alphawrangler 4.141.0Show each
1.2.5
24 Sep 2026Standardize Zod validation error output
Format validation errors with Zod's built-in
prettifyError()helper so Miniflare, Wrangler, the Vite plugin, and the Vitest plugin show consistent messages and property paths.
Patch Changes
Standardize Zod validation error output
Format validation errors with Zod's built-in
prettifyError()helper so Miniflare, Wrangler, the Vite plugin, and the Vitest plugin show consistent messages and property paths.
1.2.4
23 Sep 2026Declare the
adminSecretsStore()result as disposable and showusingin its exampleThe admin API it returns is backed by RPC stubs. Its type left out
Symbol.disposeand the documented example never released them, so a test that followed it made workerd warn that an RPC stub was not disposed properly.using admin = adminSecretsStore(env.MY_SECRET)now type checks and releases the stubs at the end of the scope.
Patch Changes
Declare the
adminSecretsStore()result as disposable and showusingin its exampleThe admin API it returns is backed by RPC stubs. Its type left out
Symbol.disposeand the documented example never released them, so a test that followed it made workerd warn that an RPC stub was not disposed properly.using admin = adminSecretsStore(env.MY_SECRET)now type checks and releases the stubs at the end of the scope.
1.2.1 – 1.2.33 releases that only update dependencieswrangler 4.136.3miniflare 5.20260921.0-alphaShow each
- 1.2.322 Sep 2026wrangler 4.136.3miniflare 5.20260921.0-alpha
- 1.2.222 Sep 2026wrangler 4.136.2miniflare 5.20260921.0-alpha
- 1.2.121 Sep 2026wrangler 4.136.1
1.2.0
21 Sep 2026Define experimental Cloudflare configuration with a single default export
Experimental
cloudflare.config.tsfiles now define settings and resources together in a default-exporteddefineConfig()call. Add a Worker underworker, add Containers to thecontainersarray, or omit both to provide settings only.import * as entrypoint from "./src/index.ts" with { type: "cf-worker" }; export default defineConfig({ accountId: "...", complianceRegion: "public", worker: { name: "my-worker", compatibilityDate: "2026-09-18", entrypoint, }, });Support nested D1 migration layouts in
readD1Migrations()readD1Migrations()now accepts the samemigrationsDir/migrationsPatternoptions Wrangler uses, so Vitest can apply Drizzle-style nested files such as0001_init/migration.sql. Discovery is shared with Wrangler via@cloudflare/workers-utils, so the test path andwrangler d1 migrations applystay aligned.The original
readD1Migrations(migrationsPath)signature still reads only top-level*.sqlfiles in that directory.
Minor Changes
Define experimental Cloudflare configuration with a single default export
Experimental
cloudflare.config.tsfiles now define settings and resources together in a default-exporteddefineConfig()call. Add a Worker underworker, add Containers to thecontainersarray, or omit both to provide settings only.import * as entrypoint from "./src/index.ts" with { type: "cf-worker" }; export default defineConfig({ accountId: "...", complianceRegion: "public", worker: { name: "my-worker", compatibilityDate: "2026-09-18", entrypoint, }, });Support nested D1 migration layouts in
readD1Migrations()readD1Migrations()now accepts the samemigrationsDir/migrationsPatternoptions Wrangler uses, so Vitest can apply Drizzle-style nested files such as0001_init/migration.sql. Discovery is shared with Wrangler via@cloudflare/workers-utils, so the test path andwrangler d1 migrations applystay aligned.The original
readD1Migrations(migrationsPath)signature still reads only top-level*.sqlfiles in that directory.
1.1.8 – 1.1.136 releases that only update dependencieswrangler 4.135.0miniflare 5.20260918.0-alphaShow each
- 1.1.1318 Sep 2026wrangler 4.135.0miniflare 5.20260918.0-alpha
- 1.1.1217 Sep 2026wrangler 4.134.0miniflare 5.20260917.0-alpha
- 1.1.1116 Sep 2026miniflare 5.20260916.0-alphawrangler 4.133.0
- 1.1.1015 Sep 2026wrangler 4.132.0miniflare 5.20260915.0-alpha
- 1.1.914 Sep 2026miniflare 5.20260911.1-alphawrangler 4.131.2
- 1.1.811 Sep 2026wrangler 4.131.1miniflare 5.20260911.0-alpha
1.1.7
10 Sep 2026Fix
cloudflare:testdeclarations composing with Wrangler-generated runtime typesThe public test helpers now avoid private workers-types-only globals and use constraints compatible with generated runtime declarations, so strict projects can keep
skipLibCheckdisabled.Prevent delayed internal errors from fetch-only remote bindings
Fetch-only remote bindings such as D1 and R2 previously opened an unused WebSocket RPC session. RPC sessions are now created only when an RPC method is called.
Patch Changes
Fix
cloudflare:testdeclarations composing with Wrangler-generated runtime typesThe public test helpers now avoid private workers-types-only globals and use constraints compatible with generated runtime declarations, so strict projects can keep
skipLibCheckdisabled.Prevent delayed internal errors from fetch-only remote bindings
Fetch-only remote bindings such as D1 and R2 previously opened an unused WebSocket RPC session. RPC sessions are now created only when an RPC method is called.
1.1.3 – 1.1.64 releases that only update dependenciesminiflare 5.20260908.0-alphawrangler 4.130.0Show each
1.1.2
28 Aug 2026Fix slowdowns and crashes in tests that repeatedly recreate Durable Objects
Tests that construct the same Durable Object many times could get progressively slower and eventually fail with a stack overflow. Repeated constructions now behave the same as the first one.
Patch Changes
Fix slowdowns and crashes in tests that repeatedly recreate Durable Objects
Tests that construct the same Durable Object many times could get progressively slower and eventually fail with a stack overflow. Repeated constructions now behave the same as the first one.
1.1.1
27 Aug 2026Only updates dependencies:miniflare 5.20260826.0-alphawrangler 4.127.0
1.1.0
25 Aug 2026Support Workerd's new module registry in Workers Vitest tests
The pool now follows Workerd's V2 module fallback protocol when
new_module_registryis selected while retaining the V1 path forlegacy_module_registry. Tests using the new registry preserve URL-basedimport.metabehavior and load CommonJS dependencies as native CommonJS modules with named exports.Add an experimental
newConfigoption for loading the Worker's configuration fromcloudflare.config.tsProjects that have migrated to the new TypeScript configuration format had no way to run their Vitest suite against their real bindings, since there was no Wrangler configuration file left to point
wrangler.configPathat. This adds the missing option, modelled on@cloudflare/vite-plugin'sexperimental.newConfig:import { cloudflareTest } from "@cloudflare/vitest-plugin"; import { defineProject } from "vitest/config"; export default defineProject({ plugins: [cloudflareTest({ experimental: { newConfig: true } })], });newConfig: trueloadscloudflare.config.tsfrom the project root; pass{ configPath: "..." }to load it from elsewhere. Config functions are called withctx.modeset to Vite's mode, which defaults to"test"and can be overridden with--mode.experimental.newConfigcannot be combined withwrangler.This is experimental and may change without a major version bump. Wrangler environments,
wrangler.config.tstooling configuration, and type generation are not supported yet.Fix "Network connection lost" when multiple test files use remote bindings
Remote proxy sessions are shared across pool workers by Wrangler config path, but were disposed during each test file's teardown. Because Vitest starts the next file's worker before the previous one finishes stopping, later files reused an already-disposed session and failed with "Network connection lost". Sessions are now disposed only once the last pool worker stops.
Minor Changes
Support Workerd's new module registry in Workers Vitest tests
The pool now follows Workerd's V2 module fallback protocol when
new_module_registryis selected while retaining the V1 path forlegacy_module_registry. Tests using the new registry preserve URL-basedimport.metabehavior and load CommonJS dependencies as native CommonJS modules with named exports.Add an experimental
newConfigoption for loading the Worker's configuration fromcloudflare.config.tsProjects that have migrated to the new TypeScript configuration format had no way to run their Vitest suite against their real bindings, since there was no Wrangler configuration file left to point
wrangler.configPathat. This adds the missing option, modelled on@cloudflare/vite-plugin'sexperimental.newConfig:import { cloudflareTest } from "@cloudflare/vitest-plugin"; import { defineProject } from "vitest/config"; export default defineProject({ plugins: [cloudflareTest({ experimental: { newConfig: true } })], });newConfig: trueloadscloudflare.config.tsfrom the project root; pass{ configPath: "..." }to load it from elsewhere. Config functions are called withctx.modeset to Vite's mode, which defaults to"test"and can be overridden with--mode.experimental.newConfigcannot be combined withwrangler.This is experimental and may change without a major version bump. Wrangler environments,
wrangler.config.tstooling configuration, and type generation are not supported yet.
Patch Changes
Fix "Network connection lost" when multiple test files use remote bindings
Remote proxy sessions are shared across pool workers by Wrangler config path, but were disposed during each test file's teardown. Because Vitest starts the next file's worker before the previous one finishes stopping, later files reused an already-disposed session and failed with "Network connection lost". Sessions are now disposed only once the last pool worker stops.
1.0.0
20 Aug 2026- breaking
Rename
@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginfor the v1 releaseThe package has been renamed from
@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginto be clearer about it's usage.To migrate, run the codemod from the root of your project:
npx @cloudflare/codemods vitest:pool-workers-to-vitest-plugin
This handles the whole rename for you:
Pass
--dry-runto preview the changes first, or--files <glob>to restrict which files are considered.If you would rather migrate by hand, the only changes needed are the dependency name in
package.json, the package specifier in anyimport/requireof the plugin, and thetypesentry in your testtsconfig.json. Add a central CLI for Cloudflare codemods
Run a codemod by name, e.g.
npx @cloudflare/codemods vitest:v3-to-v4. The initial migrations cover Vitest v3 to v4 configuration (vitest:v3-to-v4) and the@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginv1 rename (vitest:pool-workers-to-vitest-plugin). The existing Vitest transform now lives in this dedicated package.
Major Changes
- breaking
Rename
@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginfor the v1 releaseThe package has been renamed from
@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginto be clearer about it's usage.To migrate, run the codemod from the root of your project:
npx @cloudflare/codemods vitest:pool-workers-to-vitest-plugin
This handles the whole rename for you:
Replaces the dependency in your
package.json, moving plain version ranges to^1.0.0while preservingworkspace:/catalog:/link:/file:protocol references, along with anyoverrides,resolutionsandpnpm.overridesentries.Rewrites imports such as
import { cloudflareTest } from "@cloudflare/vitest-pool-workers"toimport { cloudflareTest } from "@cloudflare/vitest-plugin", preserving any subpaths.Updates the
typesentry in your testtsconfig.jsonfrom@cloudflare/vitest-pool-workers/typesto@cloudflare/vitest-plugin/types.
Pass
--dry-runto preview the changes first, or--files <glob>to restrict which files are considered.If you would rather migrate by hand, the only changes needed are the dependency name in
package.json, the package specifier in anyimport/requireof the plugin, and thetypesentry in your testtsconfig.json.
Minor Changes
Add a central CLI for Cloudflare codemods
Run a codemod by name, e.g.
npx @cloudflare/codemods vitest:v3-to-v4. The initial migrations cover Vitest v3 to v4 configuration (vitest:v3-to-v4) and the@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginv1 rename (vitest:pool-workers-to-vitest-plugin). The existing Vitest transform now lives in this dedicated package.
- 0.0.x
0.0.0
20 Aug 2026