github cloudflare/workers-sdk @cloudflare/vitest-plugin@1.1.0

Minor Changes

  • #15117 f0c9c66 Thanks @edmundhung! - 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.

  • #15272 c921b3f Thanks @penalosa! - 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.

Patch Changes

Don't miss a new workers-sdk release

NewReleases is sending notifications on new releases.