Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .changeset/c3-frameworks-update-15263.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"create-cloudflare": patch
---

Update dependencies of "create-cloudflare"

The following dependency versions have been updated:

| Dependency | From | To |
| ----------- | ------- | ------- |
| create-vike | 0.0.675 | 0.0.677 |
2 changes: 1 addition & 1 deletion .changeset/curly-codemods-juggle.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"@cloudflare/codemods": minor
"@cloudflare/vitest-pool-workers": minor
"@cloudflare/vitest-plugin": minor
---

Add a central CLI for Cloudflare codemods
Expand Down
13 changes: 13 additions & 0 deletions .changeset/cyan-planets-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@cloudflare/deploy-helpers": minor
"@cloudflare/workers-utils": minor
"wrangler": minor
---

Add container support to worker previews

Worker previews now support containers through a new `previews.containers` configuration block. Container configuration doesn't inherit, so declare containers explicitly in the `previews` block to enable them for previews. This mirrors how `previews.durable_objects` works today. Wrangler names each preview container application `{worker_name}_{preview_slug}_{class_name}`, normalising and shortening the result to what the API accepts. Either change appends a short digest of the composed name, so two names that would otherwise land on one stay distinct. An entry cannot set its own `name`, because application names are unique to an account and a fixed name would collide between two previews of the same Worker. A Durable Object class is backed by at most one container application, so the validator rejects two entries that share a `class_name`. Wrangler skips container applications bound to Durable Object classes that another Worker implements through `script_name`, because the implementing Worker owns its own container application. A binding is not required: a Durable Object declared through `migrations` or `exports` and reached only over `ctx.exports` can still back a container. Every entry must set `class_name`. A `previews.containers` entry whose `class_name` matches no Durable Object class at all is rejected before the preview deployment is created, so a typo fails loudly instead of producing a preview with no container.

Wrangler creates the container applications on `wrangler preview`. Deleting a preview tears them down server side, so `wrangler preview delete` doesn't remove them.

Container build and deploy progress prints to stdout. `wrangler preview --json` suppresses wrangler's own output so it doesn't interleave with the payload, and warnings and errors still go to stderr. Docker's build output and the progress spinner write to stdout directly and bypass that suppression, so parse `--json` from a non interactive shell, where the spinner is skipped, and prefer a prebuilt `image` over a Dockerfile.
13 changes: 13 additions & 0 deletions .changeset/dependabot-update-15264.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"miniflare": patch
"wrangler": patch
---

Update dependencies of "miniflare", "wrangler"

The following dependency versions have been updated:

| Dependency | From | To |
| ------------------------- | ------------- | ------------- |
| @cloudflare/workers-types | ^5.20260816.1 | ^5.20260819.1 |
| workerd | 1.20260816.1 | 1.20260819.1 |
23 changes: 23 additions & 0 deletions .changeset/rename-vitest-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
"@cloudflare/vitest-plugin": major
---

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:

```sh
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.0` while preserving `workspace:`/`catalog:`/`link:`/`file:` protocol references, along with any `overrides`, `resolutions` and `pnpm.overrides` entries.
- Rewrites imports such as `import { cloudflareTest } from "@cloudflare/vitest-pool-workers"` to `import { cloudflareTest } from "@cloudflare/vitest-plugin"`, preserving any subpaths.
- Updates the `types` entry in your test `tsconfig.json` from `@cloudflare/vitest-pool-workers/types` to `@cloudflare/vitest-plugin/types`.

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`.
5 changes: 5 additions & 0 deletions .changeset/tidy-ravens-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": patch
---

Update Hello World templates to use `@cloudflare/vitest-pool-workers` 0.22
2 changes: 1 addition & 1 deletion .github/skills/issue-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Map the issue to a package based on labels, title, and body content:
| `package:wrangler` label, wrangler CLI commands, `wrangler.toml`/`wrangler.json` | `packages/wrangler` |
| `package:miniflare` label, local dev simulation | `packages/miniflare` |
| `product:d1` label, D1 database, `d1 execute`, migrations | `packages/wrangler` (D1 code is in wrangler) |
| `package:vitest` label, worker tests, `vitest-pool-workers` | `packages/vitest-pool-workers` |
| `package:vitest` label, worker tests, `vitest-plugin` | `packages/vitest-plugin` |
| `package:vite-plugin` label, vite dev, `@cloudflare/vite-plugin` | `packages/vite-plugin-cloudflare` |
| `package:c3` label, `create-cloudflare`, project scaffolding | `packages/create-cloudflare` |
| `product:pages` label, Pages deployment, `_routes.json`, `_headers` | `packages/wrangler` (Pages code is in wrangler) |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Workflow changes should avoid unsuppressed `zizmor` findings. In particular:
- Tiered publishing
- Instead of `changeset publish`, the `publish` step runs `tools/deployments/publish-packages.ts`.
- Packages pin their workspace siblings at an exact version (`workspace:*` is rewritten to the sibling's version at pack time). If a dependent lands on npm before its dependency has propagated, `npm install` of the dependent fails for the window in between — the release is published but broken.
- The orchestrator therefore groups packages into dependency tiers (currently three: `miniflare` and friends, then `wrangler`, then `@cloudflare/vite-plugin` / `@cloudflare/vitest-pool-workers`) and publishes tier by tier. Packages within a tier publish in parallel, bounded by `PUBLISH_CONCURRENCY`.
- The orchestrator therefore groups packages into dependency tiers (currently three: `miniflare` and friends, then `wrangler`, then `@cloudflare/vite-plugin` / `@cloudflare/vitest-plugin`) and publishes tier by tier. Packages within a tier publish in parallel, bounded by `PUBLISH_CONCURRENCY`.
- Between tiers it polls the registry until every version just published is resolvable _and_ its tarball is fetchable, then waits a further `PUBLISH_PROPAGATION_MIN_SECONDS` — a successful read only proves the release runner's own CDN edge is up to date. That settle time is unconditional rather than a floor on the total gate duration: other edges can only serve a version once it is retrievable from the origin, and the first successful read is the best available proxy for when that happened. If a version never appears within `PUBLISH_PROPAGATION_TIMEOUT_SECONDS`, the release fails instead of publishing a broken dependent.
- Only `dependencies`/`peerDependencies`/`optionalDependencies` create ordering. `devDependencies` are excluded: consumers never install them, and including them would create cycles because packages like `wrangler` dev-depend on their own dependents.
- Packages whose exact version is already on npm are skipped, so re-running a partially failed release picks up only what is still missing. That "is it already published?" check runs once per tier _during_ the release, so its reads are retried (`PUBLISH_READ_RETRY_ATTEMPTS`, with exponential backoff) — otherwise one transient 5xx while checking a later tier would abort a run that had already published earlier tiers. A 404 is not retried, since it legitimately means "not published yet".
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-and-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ jobs:

- name: Run tests (packages)
if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.suite == 'packages-and-tools'
# We skip @cloudflare/vitest-pool-workers tests in CI on Windows because they're very flaky. We still run the vitest-pool-workers-examples fixture, which is a comprehensive set of example tests and gives us a lot of confidence.
# The @cloudflare/vitest-pool-workers tests skipped are things like watch mode, which constantly times out probably due to the github runners in use.
# We skip @cloudflare/vitest-plugin tests in CI on Windows because they're very flaky. We still run the vitest-plugin-examples fixture, which is a comprehensive set of example tests and gives us a lot of confidence.
# The @cloudflare/vitest-plugin tests skipped are things like watch mode, which constantly times out probably due to the github runners in use.
# Package tests are well-isolated (separate processes, temp dirs, random ports, MSW mocks) and can safely run in parallel.
# Concurrency is capped at 3 to avoid CPU starvation on 4-vCPU CI runners when heavyweight suites
# (wrangler/forks, miniflare/workerd, vitest-pool-workers/Verdaccio) overlap.
run: pnpm run test:ci --log-order=stream --concurrency=3 --filter="./packages/*" ${{ matrix.os == 'windows-latest' && '--filter="!./packages/vitest-pool-workers"' || '' }}
# (wrangler/forks, miniflare/workerd, vitest-plugin/Verdaccio) overlap.
run: pnpm run test:ci --log-order=stream --concurrency=3 --filter="./packages/*" ${{ matrix.os == 'windows-latest' && '--filter="!./packages/vitest-plugin"' || '' }}
env:
NODE_OPTIONS: "--max_old_space_size=8192"
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
Expand Down
2 changes: 1 addition & 1 deletion .opencode/agents/bonk.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Use triage mode when you are asked to investigate rather than change code.
- Add regression tests for bug fixes.
- Run `pnpm test:ci --filter <package>` for the touched area.
- Do not leave `.only()` in tests.
- Use `vitest-pool-workers` when you need actual Workers runtime behavior.
- Use `vitest-plugin` when you need actual Workers runtime behavior.

**Git:**

Expand Down
2 changes: 1 addition & 1 deletion .oxfmtrc.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"!packages/create-cloudflare/templates*/hello-world/**/*.*",
"packages/create-cloudflare/templates*/hello-world/**/worker-configuration.d.ts",

"packages/vitest-pool-workers/scripts/rtti/rtti.js",
"packages/vitest-plugin/scripts/rtti/rtti.js",
"packages/vite-plugin-cloudflare/playground/prisma/src/generated",
"dist-functions",
"vscode.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This is the **Cloudflare Workers SDK** monorepo containing tools and libraries f

**Development & Testing:**

- `packages/vitest-pool-workers/` - Vitest integration for testing Workers in actual runtime
- `packages/vitest-plugin/` - Vitest integration for testing Workers in actual runtime
- `packages/chrome-devtools-patches/` - Modified Chrome DevTools for Workers debugging

**Shared Libraries:**
Expand Down Expand Up @@ -125,7 +125,7 @@ This is the **Cloudflare Workers SDK** monorepo containing tools and libraries f
- Unit tests with Vitest for all packages
- Fixture tests in `/fixtures` directory for filesystem/Worker scenarios
- E2E tests require real Cloudflare account credentials
- Use `vitest-pool-workers` for testing actual Workers runtime behavior
- Use `vitest-plugin` for testing actual Workers runtime behavior
- Shared vitest config (`vitest.shared.ts`): 50s timeouts, `retry: 1`, `restoreMocks: true`
- Vitest 4 pool config: use `maxWorkers: 1` instead of the removed `poolOptions.forks.singleFork: true` when tests must run sequentially
- **`expect` must come from test context** — never `import { expect } from "vitest"`:
Expand All @@ -135,7 +135,7 @@ This is the **Cloudflare Workers SDK** monorepo containing tools and libraries f
- When test context is unavailable (e.g. setup files), use `node:assert` instead
- E2E vitest configs do NOT set `globals: true` — this rule is critical there; forgetting `{ expect }` in the callback causes `ReferenceError` at runtime
- When changing user-facing strings or output messages, update corresponding test snapshots
- New test fixtures in `vitest-pool-workers-examples/` must include a `tsconfig.json`
- New test fixtures in `vitest-plugin-examples/` must include a `tsconfig.json`
- Test fixtures serve as user-facing recipes — use clean patterns, avoid type casting where possible
- Use the `runInTmpDir()` utility instead of mocking filesystem operations. Real filesystem operations are preferred over mocking. The utility creates isolated temporary directories, handles cleanup automatically in `afterEach` hooks, and allows tests to write actual files and assert against them
- Use the `mockConsoleMethods()` helper to capture stdout/stderr. Use the pattern `const std = mockConsoleMethods()` in test setup, then access captured output via `std.out`, `std.err`, `std.warn` properties. Assert against captured output using `expect(std.out).toMatchInlineSnapshot()`
Expand Down Expand Up @@ -180,7 +180,7 @@ This is the **Cloudflare Workers SDK** monorepo containing tools and libraries f
**Package-specific tests:** Most packages have their own test suites
**Integration tests:** Use fixtures to test real-world scenarios
**E2E tests:** Test against actual Cloudflare services (requires auth)
**Workers runtime tests:** Use vitest-pool-workers for workerd-specific behavior
**Workers runtime tests:** Use vitest-plugin for workerd-specific behavior

Run `pnpm check` before submitting changes to ensure all quality gates pass.

Expand Down Expand Up @@ -228,7 +228,7 @@ Packages with their own AGENTS.md for deeper context:
- `packages/miniflare/AGENTS.md` - Worker simulation, embedded workers, build system
- `packages/vite-plugin-cloudflare/AGENTS.md` - Plugin architecture, playground setup
- `packages/create-cloudflare/AGENTS.md` - Scaffolding, template system
- `packages/vitest-pool-workers/AGENTS.md` - 3-context architecture, cloudflare:test module
- `packages/vitest-plugin/AGENTS.md` - 3-context architecture, cloudflare:test module
- `packages/workers-utils/AGENTS.md` - Shared config validation, test helpers

When making architectural changes to a package (renaming files, adding entry points, changing build output), update the relevant AGENTS.md to reflect the new structure.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ npm i https://pkg.pr.new/@cloudflare/vite-plugin@main

</p></details>

<details><summary><b>@cloudflare/vitest-pool-workers</b></summary><p>
<details><summary><b>@cloudflare/vitest-plugin</b></summary><p>

```
npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@main
npm i https://pkg.pr.new/@cloudflare/vitest-plugin@main
```

</p></details>
Expand Down
2 changes: 1 addition & 1 deletion fixtures/browser-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@cloudflare/playwright": "^1.0.0",
"@cloudflare/puppeteer": "^1.0.4",
"@cloudflare/vitest-pool-workers": "workspace:*",
"@cloudflare/vitest-plugin": "workspace:*",
"@types/node": "catalog:default",
"typescript": "catalog:default",
"vitest": "catalog:default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,6 @@ function getAuthenticatedEnv() {
};
}
console.warn(
"Skipping vitest-pool-workers remote bindings tests because the environment is not authenticated with Cloudflare."
"Skipping vitest-plugin remote bindings tests because the environment is not authenticated with Cloudflare."
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `@cloudflare/vitest-pool-workers` Examples
# `@cloudflare/vitest-plugin` Examples

This directory contains example projects tested with `@cloudflare/vitest-pool-workers`. It aims to provide the building blocks for you to write tests for your own Workers.
This directory contains example projects tested with `@cloudflare/vitest-plugin`. It aims to provide the building blocks for you to write tests for your own Workers.

| Directory | Overview |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🤖 AI and Vectorize

This Worker uses the AI and Vectorize bindings. @cloudflare/vitest-pool-workers@^0.8.1 is required to use AI and Vectorize bindings in the Vitest integration.
This Worker uses the AI and Vectorize bindings. `@cloudflare/vitest-plugin` is required to use AI and Vectorize bindings in the Vitest integration.

[!WARNING]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
import { cloudflareTest } from "@cloudflare/vitest-plugin";
import { defineProject, mergeConfig } from "vitest/config";
import configShared from "../../../vitest.shared";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
import { cloudflareTest } from "@cloudflare/vitest-plugin";
import { defineProject, mergeConfig } from "vitest/config";
import configShared from "../../../vitest.shared";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
import { cloudflareTest } from "@cloudflare/vitest-plugin";
import { defineProject, mergeConfig } from "vitest/config";
import configShared from "../../../vitest.shared";

Expand Down
3 changes: 3 additions & 0 deletions fixtures/vitest-plugin-examples/container-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Apps with no-op containers

Currently, `vitest-plugin` does not support testing containers yet. It should still let you test your application as long as you do not test with any code paths that interact with containers.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
import { cloudflareTest } from "@cloudflare/vitest-plugin";
import { defineProject, mergeConfig } from "vitest/config";
import configShared from "../../../vitest.shared";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"compilerOptions": {
"paths": {
// This path is used to simulate a virtual module that Vitest and TypeScript can understand,
// but esbuild (used by the vitest-pool-workers to guess exports) cannot.
// but esbuild (used by the vitest-plugin to guess exports) cannot.
"@virtual-module": ["./virtual.ts"]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ConfiguredVirtualDurableObject extends DurableObject<Env> {
}
}

// Although this export cannot be inferred by esbuild, it is explicitly configured in vitest-pool-workers config via `additionalExports`.
// Although this export cannot be inferred by esbuild, it is explicitly configured in vitest-plugin config via `additionalExports`.
export class ConfiguredVirtualEntryPoint extends WorkerEntrypoint<Env> {
greet() {
return `Hello ${this.env.NAME} from ConfiguredVirtualEntryPoint!`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ it("will warn on missing context exports on the main worker", async ({
expect(warnSpy).toHaveBeenCalledWith(
"Attempted to access 'ctx.exports.InvalidExport', which was not defined for the main Worker.\n" +
"Check that 'InvalidExport' is exported as an entry-point from the Worker.\n" +
"The '@cloudflare/vitest-pool-workers' integration tries to infer these exports by analyzing the source code of the main Worker.\n"
"The '@cloudflare/vitest-plugin' integration tries to infer these exports by analyzing the source code of the main Worker.\n"
);
});

Expand All @@ -49,7 +49,7 @@ it("will warn on implicit re-exports that will exist in production but cannot no
expect(warnSpy).toHaveBeenCalledWith(
"Attempted to access 'ctx.exports.ReexportedVirtualEntryPoint', which was not defined for the main Worker.\n" +
"Check that 'ReexportedVirtualEntryPoint' is exported as an entry-point from the Worker.\n" +
"The '@cloudflare/vitest-pool-workers' integration tries to infer these exports by analyzing the source code of the main Worker.\n"
"The '@cloudflare/vitest-plugin' integration tries to infer these exports by analyzing the source code of the main Worker.\n"
);
});

Expand Down
Loading
Loading