Skip to content

Commit 4e906a3

Browse files
authored
chore(wrangler): change snapshot format (#12524)
1 parent fee5549 commit 4e906a3

File tree

97 files changed

+3350
-3356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3350
-3356
lines changed

packages/wrangler/src/__tests__/api/startDevWorker/BundleController.test.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
9696
});
9797
var index_default = {
9898
fetch(request, env, ctx) {
99-
return new Response(\\"hello world\\");
99+
return new Response("hello world");
100100
}
101101
};
102102
"
@@ -123,7 +123,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
123123
});
124124
var index_default = {
125125
fetch(request, env, ctx) {
126-
return new Response(\\"hello world 2\\");
126+
return new Response("hello world 2");
127127
}
128128
};
129129
"
@@ -154,10 +154,10 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
154154
controller.onConfigUpdate({ type: "configUpdate", config });
155155
expect(findSourceFile((await ev).bundle.entrypointSource, "other.ts"))
156156
.toMatchInlineSnapshot(`
157-
"// other.ts
158-
var other_default = \\"someone\\";
159-
"
160-
`);
157+
"// other.ts
158+
var other_default = "someone";
159+
"
160+
`);
161161
expect(findSourceFile((await ev).bundle.entrypointSource, "index.ts"))
162162
.toMatchInlineSnapshot(`
163163
"// index.ts
@@ -177,10 +177,10 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
177177
});
178178
expect(findSourceFile((await ev).bundle.entrypointSource, "other.ts"))
179179
.toMatchInlineSnapshot(`
180-
"// other.ts
181-
var other_default = \\"someone else\\";
182-
"
183-
`);
180+
"// other.ts
181+
var other_default = "someone else";
182+
"
183+
`);
184184
});
185185

186186
test("custom build", async () => {
@@ -217,7 +217,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
217217
});
218218
var out_default = {
219219
fetch(request, env, ctx) {
220-
return new Response(\\"hello custom build\\");
220+
return new Response("hello custom build");
221221
}
222222
};
223223
"
@@ -239,18 +239,18 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
239239
await ev;
240240
expect(findSourceFile((await ev).bundle.entrypointSource, "out.ts"))
241241
.toMatchInlineSnapshot(`
242-
"// out.ts
243-
var out_exports = {};
244-
__export(out_exports, {
245-
default: () => out_default
246-
});
247-
var out_default = {
248-
fetch(request, env, ctx) {
249-
return new Response(\\"hello custom build 2\\");
250-
}
251-
};
252-
"
253-
`);
242+
"// out.ts
243+
var out_exports = {};
244+
__export(out_exports, {
245+
default: () => out_default
246+
});
247+
var out_default = {
248+
fetch(request, env, ctx) {
249+
return new Response("hello custom build 2");
250+
}
251+
};
252+
"
253+
`);
254254
},
255255
{ timeout: 5_000, interval: 500 }
256256
);
@@ -339,7 +339,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
339339
});
340340
var index_default = {
341341
fetch(request, env, ctx) {
342-
return new Response(\\"hello world\\");
342+
return new Response("hello world");
343343
}
344344
};
345345
"
@@ -382,7 +382,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
382382
});
383383
var out_default = {
384384
fetch(request, env, ctx) {
385-
return new Response(\\"hello custom build\\");
385+
return new Response("hello custom build");
386386
}
387387
};
388388
"
@@ -419,7 +419,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
419419
});
420420
var out_default = {
421421
fetch(request, env, ctx) {
422-
return new Response(\\"hello custom build 2\\");
422+
return new Response("hello custom build 2");
423423
}
424424
};
425425
"
@@ -467,7 +467,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
467467
});
468468
var out_default = {
469469
fetch(request, env, ctx) {
470-
return new Response(\\"hello custom build\\");
470+
return new Response("hello custom build");
471471
}
472472
};
473473
"
@@ -503,7 +503,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
503503
});
504504
var index_default = {
505505
fetch(request, env, ctx) {
506-
return new Response(\\"hello world\\");
506+
return new Response("hello world");
507507
}
508508
};
509509
"
@@ -530,7 +530,7 @@ describe("BundleController", { retry: 5, timeout: 10_000 }, () => {
530530
});
531531
var index_default = {
532532
fetch(request, env, ctx) {
533-
return new Response(\\"hello world 2\\");
533+
return new Response("hello world 2");
534534
}
535535
};
536536
"

packages/wrangler/src/__tests__/autoconfig/details/confirm-auto-config-details.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe("autoconfig details - confirmAutoConfigDetails()", () => {
3939
});
4040

4141
expect(updatedAutoConfigDetails).toMatchInlineSnapshot(`
42-
Object {
42+
{
4343
"buildCommand": "npm run build",
4444
"configured": false,
4545
"framework": Static {
@@ -90,7 +90,7 @@ describe("autoconfig details - confirmAutoConfigDetails()", () => {
9090
framework: new Static({ id: "static", name: "Static" }),
9191
});
9292
expect(updatedAutoConfigDetails).toMatchInlineSnapshot(`
93-
Object {
93+
{
9494
"buildCommand": "npm run app:build",
9595
"configured": false,
9696
"framework": Static {
@@ -141,12 +141,12 @@ describe("autoconfig details - confirmAutoConfigDetails()", () => {
141141
configured: false,
142142
});
143143
expect(updatedAutoConfigDetails).toMatchInlineSnapshot(`
144-
Object {
144+
{
145145
"buildCommand": "npm run build",
146146
"configured": false,
147147
"framework": Astro {
148148
"autoConfigSupported": true,
149-
"configurationDescription": "Configuring project for Astro with \\"astro add cloudflare\\"",
149+
"configurationDescription": "Configuring project for Astro with "astro add cloudflare"",
150150
"id": "astro",
151151
"name": "Astro",
152152
},
@@ -213,7 +213,7 @@ describe("autoconfig details - confirmAutoConfigDetails()", () => {
213213
});
214214

215215
expect(updatedAutoConfigDetails).toMatchInlineSnapshot(`
216-
Object {
216+
{
217217
"buildCommand": "npm run build",
218218
"configured": false,
219219
"framework": Static {

packages/wrangler/src/__tests__/autoconfig/run-summary.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,29 @@ describe("autoconfig run - buildOperationsSummary()", () => {
4747
"
4848
📄 Create wrangler.jsonc:
4949
{
50-
\\"$schema\\": \\"node_modules/wrangler/config-schema.json\\",
51-
\\"name\\": \\"worker-name\\",
52-
\\"compatibility_date\\": \\"2025-01-01\\",
53-
\\"observability\\": {
54-
\\"enabled\\": true
50+
"$schema": "node_modules/wrangler/config-schema.json",
51+
"name": "worker-name",
52+
"compatibility_date": "2025-01-01",
53+
"observability": {
54+
"enabled": true
5555
}
5656
}
5757
"
5858
`);
5959

6060
expect(summary).toMatchInlineSnapshot(`
61-
Object {
61+
{
6262
"buildCommand": "npm run build",
6363
"deployCommand": "npx wrangler deploy",
6464
"frameworkId": "static",
6565
"outputDir": "public",
66-
"scripts": Object {},
66+
"scripts": {},
6767
"versionCommand": "npx wrangler versions upload",
68-
"wranglerConfig": Object {
68+
"wranglerConfig": {
6969
"$schema": "node_modules/wrangler/config-schema.json",
7070
"compatibility_date": "2025-01-01",
7171
"name": "worker-name",
72-
"observability": Object {
72+
"observability": {
7373
"enabled": true,
7474
},
7575
},
@@ -109,21 +109,21 @@ describe("autoconfig run - buildOperationsSummary()", () => {
109109
);
110110

111111
expect(summary).toMatchInlineSnapshot(`
112-
Object {
112+
{
113113
"buildCommand": "npm run build",
114114
"deployCommand": "npx wrangler deploy",
115115
"frameworkId": "static",
116116
"outputDir": "dist",
117-
"scripts": Object {
117+
"scripts": {
118118
"deploy": "wrangler deploy",
119119
"preview": "wrangler dev",
120120
},
121121
"versionCommand": "npx wrangler versions upload",
122-
"wranglerConfig": Object {
122+
"wranglerConfig": {
123123
"$schema": "node_modules/wrangler/config-schema.json",
124124
"compatibility_date": "2025-01-01",
125125
"name": "worker-name",
126-
"observability": Object {
126+
"observability": {
127127
"enabled": true,
128128
},
129129
},
@@ -165,21 +165,21 @@ describe("autoconfig run - buildOperationsSummary()", () => {
165165
);
166166

167167
expect(summary).toMatchInlineSnapshot(`
168-
Object {
168+
{
169169
"buildCommand": "npm run build",
170170
"deployCommand": "npx wrangler deploy",
171171
"frameworkId": "static",
172172
"outputDir": "out",
173-
"scripts": Object {
173+
"scripts": {
174174
"deploy": "wrangler deploy",
175175
"preview": "wrangler dev",
176176
},
177177
"versionCommand": "npx wrangler versions upload",
178-
"wranglerConfig": Object {
178+
"wranglerConfig": {
179179
"$schema": "node_modules/wrangler/config-schema.json",
180180
"compatibility_date": "2025-01-01",
181181
"name": "worker-name",
182-
"observability": Object {
182+
"observability": {
183183
"enabled": true,
184184
},
185185
},

packages/wrangler/src/__tests__/autoconfig/run.test.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,19 @@ describe("autoconfig (deploy)", () => {
246246
- wrangler (devDependency)
247247
248248
📝 Update package.json scripts:
249-
- \\"deploy\\": \\"echo 'built' > build.txt && wrangler deploy\\"
250-
- \\"preview\\": \\"echo 'built' > build.txt && wrangler dev\\"
249+
- "deploy": "echo 'built' > build.txt && wrangler deploy"
250+
- "preview": "echo 'built' > build.txt && wrangler dev"
251251
252252
📄 Create wrangler.jsonc:
253253
{
254-
\\"$schema\\": \\"node_modules/wrangler/config-schema.json\\",
255-
\\"name\\": \\"my-worker\\",
256-
\\"compatibility_date\\": \\"2000-01-01\\",
257-
\\"observability\\": {
258-
\\"enabled\\": true
254+
"$schema": "node_modules/wrangler/config-schema.json",
255+
"name": "my-worker",
256+
"compatibility_date": "2000-01-01",
257+
"observability": {
258+
"enabled": true
259259
},
260-
\\"assets\\": {
261-
\\"directory\\": \\"dist\\"
260+
"assets": {
261+
"directory": "dist"
262262
}
263263
}
264264
@@ -269,14 +269,14 @@ describe("autoconfig (deploy)", () => {
269269

270270
expect(readFileSync("wrangler.jsonc")).toMatchInlineSnapshot(`
271271
"{
272-
\\"$schema\\": \\"node_modules/wrangler/config-schema.json\\",
273-
\\"name\\": \\"my-worker\\",
274-
\\"compatibility_date\\": \\"2000-01-01\\",
275-
\\"observability\\": {
276-
\\"enabled\\": true
272+
"$schema": "node_modules/wrangler/config-schema.json",
273+
"name": "my-worker",
274+
"compatibility_date": "2000-01-01",
275+
"observability": {
276+
"enabled": true
277277
},
278-
\\"assets\\": {
279-
\\"directory\\": \\"dist\\"
278+
"assets": {
279+
"directory": "dist"
280280
}
281281
}"
282282
`);
@@ -351,29 +351,29 @@ describe("autoconfig (deploy)", () => {
351351
352352
📄 Create wrangler.jsonc:
353353
{
354-
\\"$schema\\": \\"node_modules/wrangler/config-schema.json\\",
355-
\\"name\\": \\"edited-worker-name\\",
356-
\\"compatibility_date\\": \\"2000-01-01\\",
357-
\\"observability\\": {
358-
\\"enabled\\": true
354+
"$schema": "node_modules/wrangler/config-schema.json",
355+
"name": "edited-worker-name",
356+
"compatibility_date": "2000-01-01",
357+
"observability": {
358+
"enabled": true
359359
},
360-
\\"assets\\": {
361-
\\"directory\\": \\"dist\\"
360+
"assets": {
361+
"directory": "dist"
362362
}
363363
}
364364
"
365365
`);
366366

367367
expect(readFileSync("wrangler.jsonc")).toMatchInlineSnapshot(`
368368
"{
369-
\\"$schema\\": \\"node_modules/wrangler/config-schema.json\\",
370-
\\"name\\": \\"edited-worker-name\\",
371-
\\"compatibility_date\\": \\"2000-01-01\\",
372-
\\"observability\\": {
373-
\\"enabled\\": true
369+
"$schema": "node_modules/wrangler/config-schema.json",
370+
"name": "edited-worker-name",
371+
"compatibility_date": "2000-01-01",
372+
"observability": {
373+
"enabled": true
374374
},
375-
\\"assets\\": {
376-
\\"directory\\": \\"dist\\"
375+
"assets": {
376+
"directory": "dist"
377377
}
378378
}"
379379
`);

packages/wrangler/src/__tests__/cfetch-utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ describe("throwFetchError", () => {
157157
);
158158

159159
expect(std).toMatchInlineSnapshot(`
160-
Object {
160+
{
161161
"debug": "",
162162
"err": "X [ERROR] A request to the Cloudflare API (/user) failed.
163163

0 commit comments

Comments
 (0)