Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fixtures/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"description": "Shared fixtures for testing",
"devDependencies": {
"@cloudflare/workers-utils": "0.47.2",
"@cloudflare/workers-utils": "0.47.3",
"wrangler": "4.151.0"
}
}
2 changes: 1 addition & 1 deletion packages/mock-npm-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:ci": "vitest run"
},
"devDependencies": {
"@cloudflare/workers-utils": "0.47.2",
"@cloudflare/workers-utils": "0.47.3",
"@types/node": "catalog:default",
"@verdaccio/types": "^10.8.0",
"get-port": "^7.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/remote-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"test:watch": "vitest"
},
"dependencies": {
"@cloudflare/cli-shared-helpers": "0.2.6",
"@cloudflare/deploy-helpers": "0.21.0",
"@cloudflare/workers-auth": "0.14.0",
"@cloudflare/workers-utils": "0.47.2",
"@cloudflare/cli-shared-helpers": "0.2.7",
"@cloudflare/deploy-helpers": "0.22.1",
"@cloudflare/workers-auth": "0.14.1",
"@cloudflare/workers-utils": "0.47.3",
"chalk": "catalog:default",
"miniflare": "5.20261019.1-beta",
"undici": "catalog:default",
Expand Down
7 changes: 3 additions & 4 deletions packages/vite-plugin-cloudflare/e2e/remote-bindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ if (isWindows) {
) {
describe.skip("Skipping remote bindings tests without account credentials.");
} else {
describe
// Note: the reload test applies changes to the fixture files, so we do want the
// tests to run sequentially in order to avoid race conditions
.sequential("remote bindings tests", () => {
// Note: the reload test applies changes to the fixture files, so we do want the
// tests to run sequentially in order to avoid race conditions
describe("remote bindings tests", { concurrent: false }, () => {
const replacements = {
"<<REMOTE_WORKER_PLACEHOLDER>>": `preserve-e2e-vite-remote`,
"<<REMOTE_WORKER_PLACEHOLDER_ALT>>": `preserve-e2e-vite-remote-alt`,
Expand Down
6 changes: 3 additions & 3 deletions packages/vite-plugin-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
"ws": "8.22.0"
},
"devDependencies": {
"@cloudflare/containers-shared": "0.23.0",
"@cloudflare/containers-shared": "0.23.1",
"@cloudflare/mock-npm-registry": "workspace:*",
"@cloudflare/remote-bindings": "workspace:*",
"@cloudflare/workers-shared": "workspace:*",
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "5.20261019.1",
"@cloudflare/workers-utils": "0.47.2",
"@cloudflare/workers-utils": "0.47.3",
"@remix-run/node-fetch-server": "0.8.1",
"@types/node": "22.15.17",
"@types/semver": "7.8.0",
Expand All @@ -78,7 +78,7 @@
"typescript": "5.8.3",
"vite": "catalog:default",
"vite-legacy": "npm:vite@7.1.12",
"vitest": "4.1.0"
"vitest": "5.0.4"
},
"peerDependencies": {
"vite": "^6.1.0 || ^7.0.0 || ^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@cloudflare/vite-plugin": "workspace:*",
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "catalog:default",
"@cloudflare/workers-utils": "0.47.2",
"@cloudflare/workers-utils": "0.47.3",
"@prisma/adapter-d1": "^7.0.0",
"@prisma/client": "^7.0.0",
"prisma": "^7.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,84 +9,80 @@ import {
WAIT_FOR_OPTIONS,
} from "../../../__test-utils__";

describe(
"react-spa (with experimental support)",
{ sequential: true, concurrent: false },
() => {
test("returns the correct home page", async ({ expect }) => {
const content = await page.textContent("h1");
expect(content).toBe("Vite + React");
});
describe("react-spa (with experimental support)", { concurrent: false }, () => {
test("returns the correct home page", async ({ expect }) => {
const content = await page.textContent("h1");
expect(content).toBe("Vite + React");
});

test("allows updating state", async ({ expect }) => {
const button = page.getByRole("button", { name: "increment" });
const contentBefore = await button.innerText();
expect(contentBefore).toBe("count is 0");
await button.click();
const contentAfter = await button.innerText();
expect(contentAfter).toBe("count is 1");
});
test("allows updating state", async ({ expect }) => {
const button = page.getByRole("button", { name: "increment" });
const contentBefore = await button.innerText();
expect(contentBefore).toBe("count is 0");
await button.click();
const contentAfter = await button.innerText();
expect(contentAfter).toBe("count is 1");
});

test("returns the home page for not found routes", async ({ expect }) => {
await page.goto(`${viteTestUrl}/random-page`);
const content = await page.textContent("h1");
expect(content).toBe("Vite + React");
});

test("returns the home page for not found routes", async ({ expect }) => {
await page.goto(`${viteTestUrl}/random-page`);
const content = await page.textContent("h1");
expect(content).toBe("Vite + React");
// All these tests will fail without experimental support turned on
describe("_headers", () => {
test("applies _headers to HTML responses", async ({ expect }) => {
const response = await fetch(viteTestUrl);
expect(response.headers.get("X-Header")).toBe("Custom-Value!!!");
});

// All these tests will fail without experimental support turned on
describe("_headers", () => {
test("applies _headers to HTML responses", async ({ expect }) => {
const response = await fetch(viteTestUrl);
// Since Vite will return static assets immediately without invoking the Worker at all
// such requests will not have _headers applied.
failsIf(!isBuild)(
"applies _headers to static assets",
async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/vite.svg`);
expect(response.headers.get("X-Header")).toBe("Custom-Value!!!");
});
}
);
});

// Since Vite will return static assets immediately without invoking the Worker at all
// such requests will not have _headers applied.
failsIf(!isBuild)(
"applies _headers to static assets",
async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/vite.svg`);
expect(response.headers.get("X-Header")).toBe("Custom-Value!!!");
}
);
// All these tests will fail without experimental support turned on
describe("_redirects", () => {
test("applies _redirects to HTML responses", async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/foo`, {
redirect: "manual",
});
expect(response.status).toBe(302);
expect(response.headers.get("Location")).toBe("/bar");
});

// All these tests will fail without experimental support turned on
describe("_redirects", () => {
test("applies _redirects to HTML responses", async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/foo`, {
// Since Vite will return static assets immediately without invoking the Worker at all
// such requests will not have _redirects applied.
failsIf(!isBuild)(
"applies _redirects to static assets",
async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/redirect.svg`, {
redirect: "manual",
});
expect(response.status).toBe(302);
expect(response.headers.get("Location")).toBe("/bar");
});

// Since Vite will return static assets immediately without invoking the Worker at all
// such requests will not have _redirects applied.
failsIf(!isBuild)(
"applies _redirects to static assets",
async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/redirect.svg`, {
redirect: "manual",
});
expect(response.status).toBe(302);
expect(response.headers.get("Location")).toBe("/target.svg");
}
);
expect(response.headers.get("Location")).toBe("/target.svg");
}
);

// Since Vite will return static assets immediately without invoking the Worker at all
// such requests will not have _redirects applied.
failsIf(!isBuild)(
"supports proxying static assets to rewritten contents with _redirects",
async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/rewrite.svg`);
expect(response.status).toBe(200);
expect(await response.text()).toContain("target.svg");
}
);
});
}
);
// Since Vite will return static assets immediately without invoking the Worker at all
// such requests will not have _redirects applied.
failsIf(!isBuild)(
"supports proxying static assets to rewritten contents with _redirects",
async ({ expect }) => {
const response = await fetch(`${viteTestUrl}/rewrite.svg`);
expect(response.status).toBe(200);
expect(await response.text()).toContain("target.svg");
}
);
});
});

describe("reloading the server", () => {
test.skipIf(isBuild)(
Expand Down
2 changes: 1 addition & 1 deletion packages/workers-shared/asset-worker/tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"types": [
"@cloudflare/workers-types/experimental",
"@cloudflare/vitest-pool-workers/types"
"@cloudflare/vitest-plugin/types"
]
},
"include": ["**/*.ts"]
Expand Down
2 changes: 1 addition & 1 deletion packages/workers-shared/asset-worker/vitest.config.mts
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 { defineConfig } from "vitest/config";

export default defineConfig({
Expand Down
4 changes: 2 additions & 2 deletions packages/workers-shared/asset-worker/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"workers_dev": false,
"main": "src/worker.ts",
"compatibility_date": "2024-07-31",
// nodejs_compat required when using @cloudflare/vitest-pool-workers
// nodejs_compat required when using @cloudflare/vitest-plugin
// enable_ctx_exports enables ctx.exports loopback for the AssetWorkerInner
"compatibility_flags": ["nodejs_compat", "enable_ctx_exports"],
"unsafe": {
Expand Down Expand Up @@ -62,7 +62,7 @@
"staging": {
"name": "asset-worker-staging",
// enable_version_api is set per-environment (not top-level) because
// the local workerd in vitest-pool-workers does not support it yet.
// the local workerd in @cloudflare/vitest-plugin does not support it yet.
"compatibility_flags": [
"nodejs_compat",
"enable_ctx_exports",
Expand Down
2 changes: 1 addition & 1 deletion packages/workers-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"upload-sourcemaps:router-worker": "node -r esbuild-register ./scripts/upload-sourcemaps.ts --worker router-worker --tag rw-$(node -r esbuild-register ./scripts/get-version-tag.ts)"
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "catalog:default",
"@cloudflare/vitest-plugin": "catalog:default",
"@cloudflare/workers-tsconfig": "workspace:*",
"@cloudflare/workers-types": "catalog:default",
"@sentry/cli": "^2.37.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"types": [
"@cloudflare/workers-types/experimental",
"@cloudflare/vitest-pool-workers/types"
"@cloudflare/vitest-plugin/types"
]
},
"include": ["**/*.ts"]
Expand Down
2 changes: 1 addition & 1 deletion packages/workers-shared/router-worker/vitest.config.mts
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 { defineConfig } from "vitest/config";

export default defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/workers-shared/router-worker/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"workers_dev": false,
"main": "src/worker.ts",
"compatibility_date": "2024-07-31",
// nodejs_compat required when using @cloudflare/vitest-pool-workers
// nodejs_compat required when using @cloudflare/vitest-plugin
"compatibility_flags": [
"nodejs_compat",
"no_nodejs_compat_v2",
Expand Down
Loading
Loading