Packages

@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. 1.x · latest line
  2. 1.4.6

    20 Oct 2026
    • 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 undici dispatcher that Miniflare routes requests through (oven-sh/bun#39247). Under Bun, createTestHarness()'s server.fetch() and server.getWorker()'s fetch(), email() and scheduled() now throw a UserError, requests to the dev server URL get a 503 naming the cause, and starting remote bindings throws a UserError. Each of these used to hang with no error. server.getWorker().getEnv() and getExport() keep working under Bun.

  3. 1.4.5

    19 Oct 2026
    • Fix test runs slowing down file after file, and stalling, with isolate: false

      With 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.

  4. 1.4.4

    16 Oct 2026
  5. 1.4.3

    15 Oct 2026
    • Fix 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.fsModuleCache and Vitest 5's test.fsModuleCache.

  6. 1.4.1 – 1.4.22 releases that only update dependenciesminiflare 5.20261012.0-betawrangler 4.151.0Show each
  7. 1.4.0

    8 Oct 2026
    • 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

  8. 1.3.1 – 1.3.77 releases that only update dependencieswrangler 4.148.0miniflare 5.20261006.0-alphaShow each
  9. 1.3.0

    27 Sep 2026
    • Support Workflows declared in exports on ctx.exports in local development

      A Workflow declared in a Worker's exports is now available on ctx.exports in wrangler 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.exports and workflows bindings with the same Workflow name share their instances, including instances created before the Workflow was declared in exports. 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 in exports, since it doesn't run the Worker's code.

      wrangler workflows commands run with --local also work with Workflows declared only in exports, without a workflows binding.

      In the Vitest plugin, introspectWorkflow() and introspectWorkflowInstance() still need a Workflow binding, and now explain how to add one when passed a Workflow from ctx.exports. Instances created through ctx.exports are introspected too. A workflows binding whose script_name is the Worker's own name now resolves to the Worker itself again.

  10. 1.2.6 – 1.2.83 releases that only update dependenciesminiflare 5.20260925.0-alphawrangler 4.141.0Show each
  11. 1.2.5

    24 Sep 2026
    • 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.

  12. 1.2.4

    23 Sep 2026
    • Declare the adminSecretsStore() result as disposable and show using in its example

      The admin API it returns is backed by RPC stubs. Its type left out Symbol.dispose and 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.

  13. 1.2.1 – 1.2.33 releases that only update dependencieswrangler 4.136.3miniflare 5.20260921.0-alphaShow each
  14. 1.2.0

    21 Sep 2026
    • Define experimental Cloudflare configuration with a single default export

      Experimental cloudflare.config.ts files now define settings and resources together in a default-exported defineConfig() call. Add a Worker under worker, add Containers to the containers array, 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 same migrationsDir / migrationsPattern options Wrangler uses, so Vitest can apply Drizzle-style nested files such as 0001_init/migration.sql. Discovery is shared with Wrangler via @cloudflare/workers-utils, so the test path and wrangler d1 migrations apply stay aligned.

      The original readD1Migrations(migrationsPath) signature still reads only top-level *.sql files in that directory.

  15. 1.1.8 – 1.1.136 releases that only update dependencieswrangler 4.135.0miniflare 5.20260918.0-alphaShow each
  16. 1.1.7

    10 Sep 2026
    • Fix cloudflare:test declarations composing with Wrangler-generated runtime types

      The public test helpers now avoid private workers-types-only globals and use constraints compatible with generated runtime declarations, so strict projects can keep skipLibCheck disabled.

    • 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.

  17. 1.1.3 – 1.1.64 releases that only update dependenciesminiflare 5.20260908.0-alphawrangler 4.130.0Show each
  18. 1.1.2

    28 Aug 2026
    • 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.

  19. 1.1.1

    27 Aug 2026
  20. 1.1.0

    25 Aug 2026
    • Support Workerd's new module registry in Workers Vitest tests

      The pool now follows Workerd's V2 module fallback protocol when new_module_registry is selected while retaining the V1 path for legacy_module_registry. Tests using the new registry preserve URL-based import.meta behavior and load CommonJS dependencies as native CommonJS modules with named exports.

    • Add an experimental newConfig option for loading the Worker's configuration from cloudflare.config.ts

      Projects 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.configPath at. This adds the missing option, modelled on @cloudflare/vite-plugin's experimental.newConfig:

      import { cloudflareTest } from "@cloudflare/vitest-plugin";
      import { defineProject } from "vitest/config";
      
      export default defineProject({
        plugins: [cloudflareTest({ experimental: { newConfig: true } })],
      });

      newConfig: true loads cloudflare.config.ts from the project root; pass { configPath: "..." } to load it from elsewhere. Config functions are called with ctx.mode set to Vite's mode, which defaults to "test" and can be overridden with --mode. experimental.newConfig cannot be combined with wrangler.

      This is experimental and may change without a major version bump. Wrangler environments, wrangler.config.ts tooling 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.

  21. 1.0.0

    20 Aug 2026
    • breaking

      Rename @cloudflare/vitest-pool-workers to @cloudflare/vitest-plugin for the v1 release

      The package has been renamed from @cloudflare/vitest-pool-workers to @cloudflare/vitest-plugin to 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-run to 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 any import/require of the plugin, and the types entry in your test tsconfig.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-workers to @cloudflare/vitest-plugin v1 rename (vitest:pool-workers-to-vitest-plugin). The existing Vitest transform now lives in this dedicated package.

  22. 0.0.x
  23. 0.0.0

    20 Aug 2026