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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/unit/wrangler-rate-limit-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ async function readRateLimits(fileName: string): Promise<RateLimitBinding[]> {
}

describe("Wrangler mutation rate-limit bindings", () => {
it.each([
"wrangler.jsonc",
"wrangler.e2e.jsonc",
])("routes application requests through the gateway while keeping static assets direct in %s", async (fileName) => {
const source = await readFile(
new URL(`../../${fileName}`, import.meta.url),
"utf8",
);
const config = JSON.parse(source) as {
assets?: { run_worker_first?: string[] };
};

expect(config.assets?.run_worker_first).toEqual([
"/*",
"!/_app/*",
"!/images/*",
"!/static/*",
"!/openapi.generated.json",
]);
});

it("keeps public workers.dev and automatic request metadata logs disabled", async () => {
const source = await readFile(
new URL("../../wrangler.jsonc", import.meta.url),
Expand Down
9 changes: 8 additions & 1 deletion wrangler.e2e.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
},
"assets": {
"directory": ".svelte-kit/cloudflare",
"binding": "ASSETS"
"binding": "ASSETS",
"run_worker_first": [
"/*",
"!/_app/*",
"!/images/*",
"!/static/*",
"!/openapi.generated.json"
]
},
"observability": {
"enabled": false
Expand Down
9 changes: 8 additions & 1 deletion wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
},
"assets": {
"directory": ".svelte-kit/cloudflare",
"binding": "ASSETS"
"binding": "ASSETS",
"run_worker_first": [
"/*",
"!/_app/*",
"!/images/*",
"!/static/*",
"!/openapi.generated.json"
]
},
"observability": {
"enabled": true,
Expand Down