wrangler 2.0.29 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/miniflare-dist/index.mjs +1136 -372
- package/package.json +3 -2
- package/src/__tests__/helpers/mock-cfetch.ts +39 -19
- package/src/__tests__/helpers/mock-console.ts +11 -2
- package/src/__tests__/helpers/msw/handlers/index.ts +13 -0
- package/src/__tests__/helpers/msw/handlers/namespaces.ts +104 -0
- package/src/__tests__/helpers/msw/handlers/oauth.ts +36 -0
- package/src/__tests__/helpers/msw/handlers/r2.ts +80 -0
- package/src/__tests__/helpers/msw/handlers/user.ts +63 -0
- package/src/__tests__/helpers/msw/index.ts +4 -0
- package/src/__tests__/index.test.ts +9 -7
- package/src/__tests__/init.test.ts +356 -5
- package/src/__tests__/jest.setup.ts +16 -0
- package/src/__tests__/middleware.test.ts +768 -0
- package/src/__tests__/pages.test.ts +11 -12
- package/src/__tests__/publish.test.ts +516 -438
- package/src/__tests__/r2.test.ts +128 -93
- package/src/__tests__/secret.test.ts +78 -0
- package/src/__tests__/tail.test.ts +47 -74
- package/src/__tests__/whoami.test.tsx +49 -64
- package/src/api/dev.ts +23 -4
- package/src/bundle.ts +225 -1
- package/src/dev/dev.tsx +3 -1
- package/src/dev/local.tsx +2 -2
- package/src/dev/remote.tsx +6 -3
- package/src/dev/start-server.ts +11 -7
- package/src/dev/use-esbuild.ts +4 -0
- package/src/dev.tsx +6 -16
- package/src/dialogs.tsx +12 -0
- package/src/index.tsx +95 -4
- package/src/init.ts +286 -11
- package/src/miniflare-cli/assets.ts +130 -415
- package/src/miniflare-cli/index.ts +3 -1
- package/src/pages/dev.tsx +5 -1
- package/src/pages/hash.tsx +13 -0
- package/src/pages/upload.tsx +3 -18
- package/src/publish.ts +38 -4
- package/src/tail/filters.ts +1 -5
- package/src/tail/index.ts +6 -3
- package/templates/middleware/common.ts +62 -0
- package/templates/middleware/loader-modules.ts +84 -0
- package/templates/middleware/loader-sw.ts +213 -0
- package/templates/middleware/middleware-pretty-error.ts +40 -0
- package/templates/middleware/middleware-scheduled.ts +14 -0
- package/wrangler-dist/cli.js +65900 -65432
|
@@ -11,7 +11,11 @@ import {
|
|
|
11
11
|
unsetAllMocks,
|
|
12
12
|
unsetSpecialMockFns,
|
|
13
13
|
} from "./helpers/mock-cfetch";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
mockConsoleMethods,
|
|
16
|
+
normalizeSlashes,
|
|
17
|
+
normalizeTempDirs,
|
|
18
|
+
} from "./helpers/mock-console";
|
|
15
19
|
import { mockConfirm } from "./helpers/mock-dialogs";
|
|
16
20
|
import { mockGetZoneFromHostRequest } from "./helpers/mock-get-zone-from-host";
|
|
17
21
|
import { useMockIsTTY } from "./helpers/mock-istty";
|
|
@@ -47,6 +51,12 @@ describe("publish", () => {
|
|
|
47
51
|
setImmediate(fn);
|
|
48
52
|
});
|
|
49
53
|
setIsTTY(true);
|
|
54
|
+
setMockResponse(
|
|
55
|
+
"/accounts/:accountId/workers/services/:scriptName",
|
|
56
|
+
() => ({
|
|
57
|
+
default_environment: { script: { last_deployed_from: "dash" } },
|
|
58
|
+
})
|
|
59
|
+
);
|
|
50
60
|
});
|
|
51
61
|
|
|
52
62
|
afterEach(() => {
|
|
@@ -77,7 +87,7 @@ describe("publish", () => {
|
|
|
77
87
|
await runWrangler("publish ./index");
|
|
78
88
|
|
|
79
89
|
expect(std.out).toMatchInlineSnapshot(`
|
|
80
|
-
"Total Upload:
|
|
90
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
81
91
|
Worker ID: abc12345
|
|
82
92
|
Worker ETag: etag98765
|
|
83
93
|
Worker PipelineHash: hash9999
|
|
@@ -116,7 +126,7 @@ describe("publish", () => {
|
|
|
116
126
|
"Attempting to login via OAuth...
|
|
117
127
|
Opening a link in your default browser: https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20pages%3Awrite%20zone%3Aread%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
|
|
118
128
|
Successfully logged in.
|
|
119
|
-
Total Upload:
|
|
129
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
120
130
|
Uploaded test-name (TIMINGS)
|
|
121
131
|
Published test-name (TIMINGS)
|
|
122
132
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -137,7 +147,7 @@ describe("publish", () => {
|
|
|
137
147
|
await expect(runWrangler("publish index.js")).resolves.toBeUndefined();
|
|
138
148
|
|
|
139
149
|
expect(std.out).toMatchInlineSnapshot(`
|
|
140
|
-
"Total Upload:
|
|
150
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
141
151
|
Uploaded test-name (TIMINGS)
|
|
142
152
|
Published test-name (TIMINGS)
|
|
143
153
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -177,7 +187,7 @@ describe("publish", () => {
|
|
|
177
187
|
await runWrangler("publish index.js");
|
|
178
188
|
|
|
179
189
|
expect(std.out).toMatchInlineSnapshot(`
|
|
180
|
-
"Total Upload:
|
|
190
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
181
191
|
Uploaded test-name (TIMINGS)
|
|
182
192
|
Published test-name (TIMINGS)
|
|
183
193
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -201,7 +211,7 @@ describe("publish", () => {
|
|
|
201
211
|
await runWrangler("publish index.js");
|
|
202
212
|
|
|
203
213
|
expect(std.out).toMatchInlineSnapshot(`
|
|
204
|
-
"Total Upload:
|
|
214
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
205
215
|
Uploaded test-name (TIMINGS)
|
|
206
216
|
Published test-name (TIMINGS)
|
|
207
217
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -303,7 +313,7 @@ describe("publish", () => {
|
|
|
303
313
|
});
|
|
304
314
|
await runWrangler("publish index.js --env some-env");
|
|
305
315
|
expect(std.out).toMatchInlineSnapshot(`
|
|
306
|
-
"Total Upload:
|
|
316
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
307
317
|
Uploaded test-name-some-env (TIMINGS)
|
|
308
318
|
Published test-name-some-env (TIMINGS)
|
|
309
319
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -322,7 +332,7 @@ describe("publish", () => {
|
|
|
322
332
|
});
|
|
323
333
|
await runWrangler("publish index.js --legacy-env true");
|
|
324
334
|
expect(std.out).toMatchInlineSnapshot(`
|
|
325
|
-
"Total Upload:
|
|
335
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
326
336
|
Uploaded test-name (TIMINGS)
|
|
327
337
|
Published test-name (TIMINGS)
|
|
328
338
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -341,7 +351,7 @@ describe("publish", () => {
|
|
|
341
351
|
});
|
|
342
352
|
await runWrangler("publish index.js --env some-env --legacy-env true");
|
|
343
353
|
expect(std.out).toMatchInlineSnapshot(`
|
|
344
|
-
"Total Upload:
|
|
354
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
345
355
|
Uploaded test-name-some-env (TIMINGS)
|
|
346
356
|
Published test-name-some-env (TIMINGS)
|
|
347
357
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -360,7 +370,7 @@ describe("publish", () => {
|
|
|
360
370
|
});
|
|
361
371
|
await runWrangler("publish index.js --env some-env --legacy-env true");
|
|
362
372
|
expect(std.out).toMatchInlineSnapshot(`
|
|
363
|
-
"Total Upload:
|
|
373
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
364
374
|
Uploaded test-name-some-env (TIMINGS)
|
|
365
375
|
Published test-name-some-env (TIMINGS)
|
|
366
376
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -430,7 +440,7 @@ describe("publish", () => {
|
|
|
430
440
|
});
|
|
431
441
|
await runWrangler("publish index.js --legacy-env false");
|
|
432
442
|
expect(std.out).toMatchInlineSnapshot(`
|
|
433
|
-
"Total Upload:
|
|
443
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
434
444
|
Uploaded test-name (TIMINGS)
|
|
435
445
|
Published test-name (TIMINGS)
|
|
436
446
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -456,7 +466,7 @@ describe("publish", () => {
|
|
|
456
466
|
});
|
|
457
467
|
await runWrangler("publish index.js --env some-env --legacy-env false");
|
|
458
468
|
expect(std.out).toMatchInlineSnapshot(`
|
|
459
|
-
"Total Upload:
|
|
469
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
460
470
|
Uploaded test-name (some-env) (TIMINGS)
|
|
461
471
|
Published test-name (some-env) (TIMINGS)
|
|
462
472
|
https://some-env.test-name.test-sub-domain.workers.dev"
|
|
@@ -499,14 +509,14 @@ describe("publish", () => {
|
|
|
499
509
|
mockSubDomainRequest();
|
|
500
510
|
await runWrangler("publish ./some-path/worker/index.js");
|
|
501
511
|
expect(std.out).toMatchInlineSnapshot(`
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
512
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
513
|
+
Your worker has access to the following bindings:
|
|
514
|
+
- Vars:
|
|
515
|
+
- xyz: \\"123\\"
|
|
516
|
+
Uploaded test-name (TIMINGS)
|
|
517
|
+
Published test-name (TIMINGS)
|
|
518
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
519
|
+
`);
|
|
510
520
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
511
521
|
});
|
|
512
522
|
|
|
@@ -536,7 +546,7 @@ describe("publish", () => {
|
|
|
536
546
|
Object {
|
|
537
547
|
"debug": "",
|
|
538
548
|
"err": "",
|
|
539
|
-
"out": "Total Upload:
|
|
549
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
540
550
|
Uploaded test-name (TIMINGS)
|
|
541
551
|
Published test-name (TIMINGS)
|
|
542
552
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -583,7 +593,7 @@ describe("publish", () => {
|
|
|
583
593
|
Object {
|
|
584
594
|
"debug": "",
|
|
585
595
|
"err": "",
|
|
586
|
-
"out": "Total Upload:
|
|
596
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
587
597
|
Uploaded test-name (TIMINGS)
|
|
588
598
|
Published test-name (TIMINGS)
|
|
589
599
|
some-example.com/some-route/*
|
|
@@ -644,7 +654,7 @@ describe("publish", () => {
|
|
|
644
654
|
Object {
|
|
645
655
|
"debug": "",
|
|
646
656
|
"err": "",
|
|
647
|
-
"out": "Total Upload:
|
|
657
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
648
658
|
Uploaded test-name (staging) (TIMINGS)
|
|
649
659
|
Published test-name (staging) (TIMINGS)
|
|
650
660
|
some-example.com/some-route/*
|
|
@@ -750,7 +760,7 @@ describe("publish", () => {
|
|
|
750
760
|
"
|
|
751
761
|
`);
|
|
752
762
|
expect(std.out).toMatchInlineSnapshot(`
|
|
753
|
-
"Total Upload:
|
|
763
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
754
764
|
Uploaded test-name (TIMINGS)
|
|
755
765
|
Published test-name (TIMINGS)
|
|
756
766
|
example.com/some-route/*"
|
|
@@ -1030,7 +1040,7 @@ Update them to point to this script instead?`,
|
|
|
1030
1040
|
await runWrangler("publish ./index");
|
|
1031
1041
|
|
|
1032
1042
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1033
|
-
"Total Upload:
|
|
1043
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1034
1044
|
Uploaded test-name (TIMINGS)
|
|
1035
1045
|
Published test-name (TIMINGS)
|
|
1036
1046
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1047,7 +1057,7 @@ Update them to point to this script instead?`,
|
|
|
1047
1057
|
await runWrangler("publish ./index");
|
|
1048
1058
|
|
|
1049
1059
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1050
|
-
"Total Upload:
|
|
1060
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1051
1061
|
Uploaded test-name (TIMINGS)
|
|
1052
1062
|
Published test-name (TIMINGS)
|
|
1053
1063
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1064,7 +1074,7 @@ Update them to point to this script instead?`,
|
|
|
1064
1074
|
await runWrangler("publish");
|
|
1065
1075
|
|
|
1066
1076
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1067
|
-
"Total Upload:
|
|
1077
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1068
1078
|
Uploaded test-name (TIMINGS)
|
|
1069
1079
|
Published test-name (TIMINGS)
|
|
1070
1080
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1083,7 +1093,7 @@ Update them to point to this script instead?`,
|
|
|
1083
1093
|
await runWrangler("publish");
|
|
1084
1094
|
|
|
1085
1095
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1086
|
-
"Total Upload:
|
|
1096
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1087
1097
|
Uploaded test-name (TIMINGS)
|
|
1088
1098
|
Published test-name (TIMINGS)
|
|
1089
1099
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1100,7 +1110,7 @@ Update them to point to this script instead?`,
|
|
|
1100
1110
|
await runWrangler("publish");
|
|
1101
1111
|
|
|
1102
1112
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1103
|
-
"Total Upload:
|
|
1113
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1104
1114
|
Uploaded test-name (TIMINGS)
|
|
1105
1115
|
Published test-name (TIMINGS)
|
|
1106
1116
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1136,7 +1146,7 @@ Update them to point to this script instead?`,
|
|
|
1136
1146
|
await runWrangler("publish");
|
|
1137
1147
|
|
|
1138
1148
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1139
|
-
"Total Upload:
|
|
1149
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1140
1150
|
Uploaded test-name (TIMINGS)
|
|
1141
1151
|
Published test-name (TIMINGS)
|
|
1142
1152
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1186,7 +1196,7 @@ Update them to point to this script instead?`,
|
|
|
1186
1196
|
await runWrangler("publish index.ts");
|
|
1187
1197
|
|
|
1188
1198
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1189
|
-
"Total Upload:
|
|
1199
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1190
1200
|
Uploaded test-name (TIMINGS)
|
|
1191
1201
|
Published test-name (TIMINGS)
|
|
1192
1202
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1205,7 +1215,7 @@ Update them to point to this script instead?`,
|
|
|
1205
1215
|
await runWrangler("publish index.ts");
|
|
1206
1216
|
|
|
1207
1217
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1208
|
-
"Total Upload:
|
|
1218
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1209
1219
|
Uploaded test-name (TIMINGS)
|
|
1210
1220
|
Published test-name (TIMINGS)
|
|
1211
1221
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1236,7 +1246,7 @@ export default{
|
|
|
1236
1246
|
mockSubDomainRequest();
|
|
1237
1247
|
await runWrangler("publish index.js");
|
|
1238
1248
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1239
|
-
"Total Upload:
|
|
1249
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1240
1250
|
Uploaded test-name (TIMINGS)
|
|
1241
1251
|
Published test-name (TIMINGS)
|
|
1242
1252
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1253,7 +1263,7 @@ export default{
|
|
|
1253
1263
|
await runWrangler("publish ./src/index.js");
|
|
1254
1264
|
|
|
1255
1265
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1256
|
-
"Total Upload:
|
|
1266
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1257
1267
|
Uploaded test-name (TIMINGS)
|
|
1258
1268
|
Published test-name (TIMINGS)
|
|
1259
1269
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1290,14 +1300,14 @@ export default {};`
|
|
|
1290
1300
|
`);
|
|
1291
1301
|
|
|
1292
1302
|
expect(std).toMatchInlineSnapshot(`
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1303
|
+
Object {
|
|
1304
|
+
"debug": "",
|
|
1305
|
+
"err": "",
|
|
1306
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
1307
|
+
--dry-run: exiting now.",
|
|
1308
|
+
"warn": "",
|
|
1309
|
+
}
|
|
1310
|
+
`);
|
|
1301
1311
|
});
|
|
1302
1312
|
|
|
1303
1313
|
it("should not preserve exports on a service-worker format worker", async () => {
|
|
@@ -1323,16 +1333,16 @@ addEventListener('fetch', event => {});`
|
|
|
1323
1333
|
).toMatchInlineSnapshot(`Array []`);
|
|
1324
1334
|
|
|
1325
1335
|
expect(std).toMatchInlineSnapshot(`
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1336
|
+
Object {
|
|
1337
|
+
"debug": "",
|
|
1338
|
+
"err": "",
|
|
1339
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
1340
|
+
--dry-run: exiting now.",
|
|
1341
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mThe entrypoint index.js has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using \\"service-worker\\" format...[0m
|
|
1332
1342
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1343
|
+
",
|
|
1344
|
+
}
|
|
1345
|
+
`);
|
|
1336
1346
|
});
|
|
1337
1347
|
|
|
1338
1348
|
it("should be able to transpile entry-points in sub-directories (sw)", async () => {
|
|
@@ -1347,7 +1357,7 @@ addEventListener('fetch', event => {});`
|
|
|
1347
1357
|
await runWrangler("publish ./src/index.js");
|
|
1348
1358
|
|
|
1349
1359
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1350
|
-
"Total Upload:
|
|
1360
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1351
1361
|
Uploaded test-name (TIMINGS)
|
|
1352
1362
|
Published test-name (TIMINGS)
|
|
1353
1363
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1429,7 +1439,7 @@ addEventListener('fetch', event => {});`
|
|
|
1429
1439
|
Reading file-2.txt...
|
|
1430
1440
|
Uploading as file-2.5938485188.txt...
|
|
1431
1441
|
↗️ Done syncing assets
|
|
1432
|
-
Total Upload:
|
|
1442
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1433
1443
|
Uploaded test-name (TIMINGS)
|
|
1434
1444
|
Published test-name (TIMINGS)
|
|
1435
1445
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1481,7 +1491,7 @@ addEventListener('fetch', event => {});`
|
|
|
1481
1491
|
Reading file-2.txt...
|
|
1482
1492
|
Uploading as file-2.5938485188.txt...
|
|
1483
1493
|
↗️ Done syncing assets
|
|
1484
|
-
Total Upload:
|
|
1494
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1485
1495
|
Uploaded test-name (TIMINGS)
|
|
1486
1496
|
Published test-name (TIMINGS)
|
|
1487
1497
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1570,7 +1580,7 @@ addEventListener('fetch', event => {});`
|
|
|
1570
1580
|
Reading file-2.txt...
|
|
1571
1581
|
Uploading as file-2.5938485188.txt...
|
|
1572
1582
|
↗️ Done syncing assets
|
|
1573
|
-
Total Upload:
|
|
1583
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1574
1584
|
Uploaded test-name (TIMINGS)
|
|
1575
1585
|
Published test-name (TIMINGS)
|
|
1576
1586
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1618,7 +1628,7 @@ addEventListener('fetch', event => {});`
|
|
|
1618
1628
|
Reading file-2.txt...
|
|
1619
1629
|
Uploading as file-2.5938485188.txt...
|
|
1620
1630
|
↗️ Done syncing assets
|
|
1621
|
-
Total Upload:
|
|
1631
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1622
1632
|
Uploaded test-name (TIMINGS)
|
|
1623
1633
|
Published test-name (TIMINGS)
|
|
1624
1634
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1658,7 +1668,7 @@ addEventListener('fetch', event => {});`
|
|
|
1658
1668
|
Reading file-2.txt...
|
|
1659
1669
|
Uploading as file-2.5938485188.txt...
|
|
1660
1670
|
↗️ Done syncing assets
|
|
1661
|
-
Total Upload:
|
|
1671
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1662
1672
|
Uploaded test-name (TIMINGS)
|
|
1663
1673
|
Published test-name (TIMINGS)
|
|
1664
1674
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1842,7 +1852,7 @@ addEventListener('fetch', event => {});`
|
|
|
1842
1852
|
Reading subdir/file-2.txt...
|
|
1843
1853
|
Uploading as subdir/file-2.5938485188.txt...
|
|
1844
1854
|
↗️ Done syncing assets
|
|
1845
|
-
Total Upload:
|
|
1855
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1846
1856
|
Uploaded test-name (TIMINGS)
|
|
1847
1857
|
Published test-name (TIMINGS)
|
|
1848
1858
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1888,7 +1898,7 @@ addEventListener('fetch', event => {});`
|
|
|
1888
1898
|
Reading subdir/file-2.txt...
|
|
1889
1899
|
Uploading as subdir/file-2.5938485188.txt...
|
|
1890
1900
|
↗️ Done syncing assets
|
|
1891
|
-
Total Upload:
|
|
1901
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1892
1902
|
Uploaded test-name (TIMINGS)
|
|
1893
1903
|
Published test-name (TIMINGS)
|
|
1894
1904
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1944,7 +1954,7 @@ addEventListener('fetch', event => {});`
|
|
|
1944
1954
|
Reading subdir/file-2.txt...
|
|
1945
1955
|
Uploading as subdir/file-2.5938485188.txt...
|
|
1946
1956
|
↗️ Done syncing assets
|
|
1947
|
-
Total Upload:
|
|
1957
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1948
1958
|
Uploaded test-name (TIMINGS)
|
|
1949
1959
|
Published test-name (TIMINGS)
|
|
1950
1960
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2001,7 +2011,7 @@ addEventListener('fetch', event => {});`
|
|
|
2001
2011
|
Reading file-2.txt...
|
|
2002
2012
|
Uploading as file-2.5938485188.txt...
|
|
2003
2013
|
↗️ Done syncing assets
|
|
2004
|
-
Total Upload:
|
|
2014
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2005
2015
|
Uploaded test-name (TIMINGS)
|
|
2006
2016
|
Published test-name (TIMINGS)
|
|
2007
2017
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2052,7 +2062,7 @@ addEventListener('fetch', event => {});`
|
|
|
2052
2062
|
Reading file-2.txt...
|
|
2053
2063
|
Uploading as file-2.5938485188.txt...
|
|
2054
2064
|
↗️ Done syncing assets
|
|
2055
|
-
Total Upload:
|
|
2065
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2056
2066
|
Uploaded test-name (TIMINGS)
|
|
2057
2067
|
Published test-name (TIMINGS)
|
|
2058
2068
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2101,7 +2111,7 @@ addEventListener('fetch', event => {});`
|
|
|
2101
2111
|
Reading file-2.txt...
|
|
2102
2112
|
Uploading as file-2.5938485188.txt...
|
|
2103
2113
|
↗️ Done syncing assets
|
|
2104
|
-
Total Upload:
|
|
2114
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2105
2115
|
Uploaded test-name (some-env) (TIMINGS)
|
|
2106
2116
|
Published test-name (some-env) (TIMINGS)
|
|
2107
2117
|
https://some-env.test-name.test-sub-domain.workers.dev"
|
|
@@ -2151,7 +2161,7 @@ addEventListener('fetch', event => {});`
|
|
|
2151
2161
|
Reading file-2.txt...
|
|
2152
2162
|
Uploading as file-2.5938485188.txt...
|
|
2153
2163
|
↗️ Done syncing assets
|
|
2154
|
-
Total Upload:
|
|
2164
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2155
2165
|
Uploaded test-name-some-env (TIMINGS)
|
|
2156
2166
|
Published test-name-some-env (TIMINGS)
|
|
2157
2167
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -2194,7 +2204,7 @@ addEventListener('fetch', event => {});`
|
|
|
2194
2204
|
Reading file-2.txt...
|
|
2195
2205
|
Uploading as file-2.5938485188.txt...
|
|
2196
2206
|
↗️ Done syncing assets
|
|
2197
|
-
Total Upload:
|
|
2207
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2198
2208
|
Uploaded test-name (TIMINGS)
|
|
2199
2209
|
Published test-name (TIMINGS)
|
|
2200
2210
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2234,7 +2244,7 @@ addEventListener('fetch', event => {});`
|
|
|
2234
2244
|
"Reading file-1.txt...
|
|
2235
2245
|
Uploading as file-1.2ca234f380.txt...
|
|
2236
2246
|
↗️ Done syncing assets
|
|
2237
|
-
Total Upload:
|
|
2247
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2238
2248
|
Uploaded test-name (TIMINGS)
|
|
2239
2249
|
Published test-name (TIMINGS)
|
|
2240
2250
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2274,7 +2284,7 @@ addEventListener('fetch', event => {});`
|
|
|
2274
2284
|
"Reading file-1.txt...
|
|
2275
2285
|
Uploading as file-1.2ca234f380.txt...
|
|
2276
2286
|
↗️ Done syncing assets
|
|
2277
|
-
Total Upload:
|
|
2287
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2278
2288
|
Uploaded test-name (TIMINGS)
|
|
2279
2289
|
Published test-name (TIMINGS)
|
|
2280
2290
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2315,7 +2325,7 @@ addEventListener('fetch', event => {});`
|
|
|
2315
2325
|
"Reading file-1.txt...
|
|
2316
2326
|
Uploading as file-1.2ca234f380.txt...
|
|
2317
2327
|
↗️ Done syncing assets
|
|
2318
|
-
Total Upload:
|
|
2328
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2319
2329
|
Uploaded test-name (TIMINGS)
|
|
2320
2330
|
Published test-name (TIMINGS)
|
|
2321
2331
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2356,7 +2366,7 @@ addEventListener('fetch', event => {});`
|
|
|
2356
2366
|
"Reading file-1.txt...
|
|
2357
2367
|
Uploading as file-1.2ca234f380.txt...
|
|
2358
2368
|
↗️ Done syncing assets
|
|
2359
|
-
Total Upload:
|
|
2369
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2360
2370
|
Uploaded test-name (TIMINGS)
|
|
2361
2371
|
Published test-name (TIMINGS)
|
|
2362
2372
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2397,7 +2407,7 @@ addEventListener('fetch', event => {});`
|
|
|
2397
2407
|
"Reading file-1.txt...
|
|
2398
2408
|
Uploading as file-1.2ca234f380.txt...
|
|
2399
2409
|
↗️ Done syncing assets
|
|
2400
|
-
Total Upload:
|
|
2410
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2401
2411
|
Uploaded test-name (TIMINGS)
|
|
2402
2412
|
Published test-name (TIMINGS)
|
|
2403
2413
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2438,7 +2448,7 @@ addEventListener('fetch', event => {});`
|
|
|
2438
2448
|
"Reading file-1.txt...
|
|
2439
2449
|
Uploading as file-1.2ca234f380.txt...
|
|
2440
2450
|
↗️ Done syncing assets
|
|
2441
|
-
Total Upload:
|
|
2451
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2442
2452
|
Uploaded test-name (TIMINGS)
|
|
2443
2453
|
Published test-name (TIMINGS)
|
|
2444
2454
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2481,7 +2491,7 @@ addEventListener('fetch', event => {});`
|
|
|
2481
2491
|
"Reading directory-1/file-1.txt...
|
|
2482
2492
|
Uploading as directory-1/file-1.2ca234f380.txt...
|
|
2483
2493
|
↗️ Done syncing assets
|
|
2484
|
-
Total Upload:
|
|
2494
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2485
2495
|
Uploaded test-name (TIMINGS)
|
|
2486
2496
|
Published test-name (TIMINGS)
|
|
2487
2497
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2528,7 +2538,7 @@ addEventListener('fetch', event => {});`
|
|
|
2528
2538
|
"Reading .well-known/file-2.txt...
|
|
2529
2539
|
Uploading as .well-known/file-2.5938485188.txt...
|
|
2530
2540
|
↗️ Done syncing assets
|
|
2531
|
-
Total Upload:
|
|
2541
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2532
2542
|
Uploaded test-name (TIMINGS)
|
|
2533
2543
|
Published test-name (TIMINGS)
|
|
2534
2544
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2677,7 +2687,7 @@ addEventListener('fetch', event => {});`
|
|
|
2677
2687
|
Reading file-19.txt...
|
|
2678
2688
|
Uploading as file-19.f0d69f705d.txt...
|
|
2679
2689
|
↗️ Done syncing assets
|
|
2680
|
-
Total Upload:
|
|
2690
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2681
2691
|
Uploaded test-name (TIMINGS)
|
|
2682
2692
|
Published test-name (TIMINGS)
|
|
2683
2693
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -2776,7 +2786,7 @@ addEventListener('fetch', event => {});`
|
|
|
2776
2786
|
Deleting file-3.somehash.txt from the asset store...
|
|
2777
2787
|
Deleting file-4.anotherhash.txt from the asset store...
|
|
2778
2788
|
↗️ Done syncing assets
|
|
2779
|
-
Total Upload:
|
|
2789
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2780
2790
|
Uploaded test-name (TIMINGS)
|
|
2781
2791
|
Published test-name (TIMINGS)
|
|
2782
2792
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2830,7 +2840,7 @@ addEventListener('fetch', event => {});`
|
|
|
2830
2840
|
Reading file-2.txt...
|
|
2831
2841
|
Uploading as file-2.5938485188.txt...
|
|
2832
2842
|
↗️ Done syncing assets
|
|
2833
|
-
Total Upload:
|
|
2843
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2834
2844
|
Uploaded test-name (TIMINGS)
|
|
2835
2845
|
Published test-name (TIMINGS)
|
|
2836
2846
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2871,7 +2881,7 @@ addEventListener('fetch', event => {});`
|
|
|
2871
2881
|
Reading file-2.txt...
|
|
2872
2882
|
Uploading as file-2.5938485188.txt...
|
|
2873
2883
|
↗️ Done syncing assets
|
|
2874
|
-
Total Upload:
|
|
2884
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2875
2885
|
Uploaded test-name (TIMINGS)
|
|
2876
2886
|
Published test-name (TIMINGS)
|
|
2877
2887
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -2913,7 +2923,7 @@ addEventListener('fetch', event => {});`
|
|
|
2913
2923
|
Reading file-2.txt...
|
|
2914
2924
|
Uploading as file-2.5938485188.txt...
|
|
2915
2925
|
↗️ Done syncing assets
|
|
2916
|
-
Total Upload:
|
|
2926
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2917
2927
|
Uploaded test-name (TIMINGS)
|
|
2918
2928
|
Published test-name (TIMINGS)
|
|
2919
2929
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -2935,7 +2945,7 @@ addEventListener('fetch', event => {});`
|
|
|
2935
2945
|
await runWrangler("publish ./index");
|
|
2936
2946
|
|
|
2937
2947
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2938
|
-
"Total Upload:
|
|
2948
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2939
2949
|
Uploaded test-name (TIMINGS)
|
|
2940
2950
|
Published test-name (TIMINGS)
|
|
2941
2951
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2955,7 +2965,7 @@ addEventListener('fetch', event => {});`
|
|
|
2955
2965
|
await runWrangler("publish ./index");
|
|
2956
2966
|
|
|
2957
2967
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2958
|
-
"Total Upload:
|
|
2968
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2959
2969
|
Uploaded test-name (TIMINGS)
|
|
2960
2970
|
Published test-name (TIMINGS)
|
|
2961
2971
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2974,7 +2984,7 @@ addEventListener('fetch', event => {});`
|
|
|
2974
2984
|
await runWrangler("publish ./index");
|
|
2975
2985
|
|
|
2976
2986
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2977
|
-
"Total Upload:
|
|
2987
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2978
2988
|
Uploaded test-name (TIMINGS)
|
|
2979
2989
|
Published test-name (TIMINGS)
|
|
2980
2990
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2993,7 +3003,7 @@ addEventListener('fetch', event => {});`
|
|
|
2993
3003
|
await runWrangler("publish ./index");
|
|
2994
3004
|
|
|
2995
3005
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2996
|
-
"Total Upload:
|
|
3006
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2997
3007
|
Uploaded test-name (TIMINGS)
|
|
2998
3008
|
No publish targets for test-name (TIMINGS)"
|
|
2999
3009
|
`);
|
|
@@ -3013,7 +3023,7 @@ addEventListener('fetch', event => {});`
|
|
|
3013
3023
|
await runWrangler("publish ./index");
|
|
3014
3024
|
|
|
3015
3025
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3016
|
-
"Total Upload:
|
|
3026
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3017
3027
|
Uploaded test-name (TIMINGS)
|
|
3018
3028
|
No publish targets for test-name (TIMINGS)"
|
|
3019
3029
|
`);
|
|
@@ -3037,7 +3047,7 @@ addEventListener('fetch', event => {});`
|
|
|
3037
3047
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3038
3048
|
|
|
3039
3049
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3040
|
-
"Total Upload:
|
|
3050
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3041
3051
|
Uploaded test-name (dev) (TIMINGS)
|
|
3042
3052
|
No publish targets for test-name (dev) (TIMINGS)"
|
|
3043
3053
|
`);
|
|
@@ -3062,7 +3072,7 @@ addEventListener('fetch', event => {});`
|
|
|
3062
3072
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3063
3073
|
|
|
3064
3074
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3065
|
-
"Total Upload:
|
|
3075
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3066
3076
|
Uploaded test-name (dev) (TIMINGS)
|
|
3067
3077
|
No publish targets for test-name (dev) (TIMINGS)"
|
|
3068
3078
|
`);
|
|
@@ -3087,7 +3097,7 @@ addEventListener('fetch', event => {});`
|
|
|
3087
3097
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3088
3098
|
|
|
3089
3099
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3090
|
-
"Total Upload:
|
|
3100
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3091
3101
|
Uploaded test-name (dev) (TIMINGS)
|
|
3092
3102
|
Published test-name (dev) (TIMINGS)
|
|
3093
3103
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3114,7 +3124,7 @@ addEventListener('fetch', event => {});`
|
|
|
3114
3124
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3115
3125
|
|
|
3116
3126
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3117
|
-
"Total Upload:
|
|
3127
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3118
3128
|
Uploaded test-name (dev) (TIMINGS)
|
|
3119
3129
|
Published test-name (dev) (TIMINGS)
|
|
3120
3130
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3142,7 +3152,7 @@ addEventListener('fetch', event => {});`
|
|
|
3142
3152
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3143
3153
|
|
|
3144
3154
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3145
|
-
"Total Upload:
|
|
3155
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3146
3156
|
Uploaded test-name (dev) (TIMINGS)
|
|
3147
3157
|
Published test-name (dev) (TIMINGS)
|
|
3148
3158
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3173,7 +3183,7 @@ addEventListener('fetch', event => {});`
|
|
|
3173
3183
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3174
3184
|
|
|
3175
3185
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3176
|
-
"Total Upload:
|
|
3186
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3177
3187
|
Uploaded test-name (dev) (TIMINGS)
|
|
3178
3188
|
Published test-name (dev) (TIMINGS)
|
|
3179
3189
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3206,7 +3216,7 @@ addEventListener('fetch', event => {});`
|
|
|
3206
3216
|
);
|
|
3207
3217
|
|
|
3208
3218
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3209
|
-
"Total Upload:
|
|
3219
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3210
3220
|
Uploaded test-name (dev) (TIMINGS)
|
|
3211
3221
|
Published test-name (dev) (TIMINGS)
|
|
3212
3222
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3233,6 +3243,29 @@ addEventListener('fetch', event => {});`
|
|
|
3233
3243
|
`);
|
|
3234
3244
|
});
|
|
3235
3245
|
|
|
3246
|
+
it("should error if a compatibility_date is missing and suggest the correct month", async () => {
|
|
3247
|
+
jest.spyOn(Date.prototype, "getMonth").mockImplementation(() => 11);
|
|
3248
|
+
jest.spyOn(Date.prototype, "getFullYear").mockImplementation(() => 2020);
|
|
3249
|
+
jest.spyOn(Date.prototype, "getDate").mockImplementation(() => 1);
|
|
3250
|
+
|
|
3251
|
+
writeWorkerSource();
|
|
3252
|
+
let err: undefined | Error;
|
|
3253
|
+
try {
|
|
3254
|
+
await runWrangler("publish ./index.js");
|
|
3255
|
+
} catch (e) {
|
|
3256
|
+
err = e as Error;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
expect(err?.message).toMatchInlineSnapshot(`
|
|
3260
|
+
"A compatibility_date is required when publishing. Add the following to your wrangler.toml file:.
|
|
3261
|
+
\`\`\`
|
|
3262
|
+
compatibility_date = \\"2020-12-01\\"
|
|
3263
|
+
\`\`\`
|
|
3264
|
+
Or you could pass it in your terminal as \`--compatibility-date 2020-12-01\`
|
|
3265
|
+
See https://developers.cloudflare.com/workers/platform/compatibility-dates for more information."
|
|
3266
|
+
`);
|
|
3267
|
+
});
|
|
3268
|
+
|
|
3236
3269
|
it("should enable the workers.dev domain if workers_dev is undefined and subdomain is not already available", async () => {
|
|
3237
3270
|
writeWranglerToml();
|
|
3238
3271
|
writeWorkerSource();
|
|
@@ -3243,7 +3276,7 @@ addEventListener('fetch', event => {});`
|
|
|
3243
3276
|
await runWrangler("publish ./index");
|
|
3244
3277
|
|
|
3245
3278
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3246
|
-
"Total Upload:
|
|
3279
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3247
3280
|
Uploaded test-name (TIMINGS)
|
|
3248
3281
|
Published test-name (TIMINGS)
|
|
3249
3282
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3261,7 +3294,7 @@ addEventListener('fetch', event => {});`
|
|
|
3261
3294
|
await runWrangler("publish ./index");
|
|
3262
3295
|
|
|
3263
3296
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3264
|
-
"Total Upload:
|
|
3297
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3265
3298
|
Uploaded test-name (TIMINGS)
|
|
3266
3299
|
Published test-name (TIMINGS)
|
|
3267
3300
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3299,7 +3332,7 @@ addEventListener('fetch', event => {});`
|
|
|
3299
3332
|
await runWrangler("publish index.js");
|
|
3300
3333
|
|
|
3301
3334
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3302
|
-
"Total Upload:
|
|
3335
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3303
3336
|
Uploaded test-name (TIMINGS)
|
|
3304
3337
|
Published test-name (TIMINGS)
|
|
3305
3338
|
http://example.com/*"
|
|
@@ -3333,7 +3366,7 @@ addEventListener('fetch', event => {});`
|
|
|
3333
3366
|
await runWrangler("publish index.js --env production");
|
|
3334
3367
|
|
|
3335
3368
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3336
|
-
"Total Upload:
|
|
3369
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3337
3370
|
Uploaded test-name-production (TIMINGS)
|
|
3338
3371
|
Published test-name-production (TIMINGS)
|
|
3339
3372
|
http://production.example.com/*"
|
|
@@ -3366,7 +3399,7 @@ addEventListener('fetch', event => {});`
|
|
|
3366
3399
|
await runWrangler("publish index.js --env production");
|
|
3367
3400
|
|
|
3368
3401
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3369
|
-
"Total Upload:
|
|
3402
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3370
3403
|
Uploaded test-name-production (TIMINGS)
|
|
3371
3404
|
Published test-name-production (TIMINGS)
|
|
3372
3405
|
http://production.example.com/*"
|
|
@@ -3392,7 +3425,7 @@ addEventListener('fetch', event => {});`
|
|
|
3392
3425
|
await runWrangler("publish index.js");
|
|
3393
3426
|
|
|
3394
3427
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3395
|
-
"Total Upload:
|
|
3428
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3396
3429
|
Uploaded test-name (TIMINGS)
|
|
3397
3430
|
Published test-name (TIMINGS)
|
|
3398
3431
|
https://test-name.test-sub-domain.workers.dev
|
|
@@ -3427,7 +3460,7 @@ addEventListener('fetch', event => {});`
|
|
|
3427
3460
|
await runWrangler("publish index.js --env production");
|
|
3428
3461
|
|
|
3429
3462
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3430
|
-
"Total Upload:
|
|
3463
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3431
3464
|
Uploaded test-name-production (TIMINGS)
|
|
3432
3465
|
Published test-name-production (TIMINGS)
|
|
3433
3466
|
https://test-name-production.test-sub-domain.workers.dev
|
|
@@ -3462,7 +3495,7 @@ addEventListener('fetch', event => {});`
|
|
|
3462
3495
|
await runWrangler("publish index.js --env production");
|
|
3463
3496
|
|
|
3464
3497
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3465
|
-
"Total Upload:
|
|
3498
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3466
3499
|
Uploaded test-name-production (TIMINGS)
|
|
3467
3500
|
Published test-name-production (TIMINGS)
|
|
3468
3501
|
https://test-name-production.test-sub-domain.workers.dev
|
|
@@ -3497,7 +3530,7 @@ addEventListener('fetch', event => {});`
|
|
|
3497
3530
|
await runWrangler("publish index.js --env production");
|
|
3498
3531
|
|
|
3499
3532
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3500
|
-
"Total Upload:
|
|
3533
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3501
3534
|
Uploaded test-name-production (TIMINGS)
|
|
3502
3535
|
Published test-name-production (TIMINGS)
|
|
3503
3536
|
http://production.example.com/*"
|
|
@@ -3531,7 +3564,7 @@ addEventListener('fetch', event => {});`
|
|
|
3531
3564
|
await runWrangler("publish index.js --env production");
|
|
3532
3565
|
|
|
3533
3566
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3534
|
-
"Total Upload:
|
|
3567
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3535
3568
|
Uploaded test-name-production (TIMINGS)
|
|
3536
3569
|
Published test-name-production (TIMINGS)
|
|
3537
3570
|
http://production.example.com/*"
|
|
@@ -3569,20 +3602,17 @@ addEventListener('fetch', event => {});`
|
|
|
3569
3602
|
mockSubDomainRequest();
|
|
3570
3603
|
mockUploadWorkerRequest();
|
|
3571
3604
|
await runWrangler("build");
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
//# sourceMappingURL=index.js.map
|
|
3584
|
-
"
|
|
3585
|
-
`);
|
|
3605
|
+
|
|
3606
|
+
const outFile = normalizeSlashes(
|
|
3607
|
+
normalizeTempDirs(fs.readFileSync("dist/index.js", "utf-8"))
|
|
3608
|
+
);
|
|
3609
|
+
|
|
3610
|
+
// We don't check against the whole file as there is middleware being injected
|
|
3611
|
+
expect(outFile).toContain("console.log(123);");
|
|
3612
|
+
expect(outFile).toContain("console.log(globalThis.abc);");
|
|
3613
|
+
expect(outFile).toContain(`const abc2 = "a string";`);
|
|
3614
|
+
expect(outFile).toContain("console.log(abc2);");
|
|
3615
|
+
expect(outFile).toContain("console.log(foo);");
|
|
3586
3616
|
});
|
|
3587
3617
|
|
|
3588
3618
|
it("can be overriden in environments", async () => {
|
|
@@ -3608,14 +3638,13 @@ addEventListener('fetch', event => {});`
|
|
|
3608
3638
|
mockSubDomainRequest();
|
|
3609
3639
|
mockUploadWorkerRequest();
|
|
3610
3640
|
await runWrangler("build --env staging");
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
`);
|
|
3641
|
+
|
|
3642
|
+
const outFile = normalizeSlashes(
|
|
3643
|
+
normalizeTempDirs(fs.readFileSync("dist/index.js", "utf-8"))
|
|
3644
|
+
);
|
|
3645
|
+
|
|
3646
|
+
// We don't check against the whole file as there is middleware being injected
|
|
3647
|
+
expect(outFile).toContain("console.log(456);");
|
|
3619
3648
|
});
|
|
3620
3649
|
|
|
3621
3650
|
it("can be overridden with cli args", async () => {
|
|
@@ -3634,14 +3663,10 @@ addEventListener('fetch', event => {});`
|
|
|
3634
3663
|
mockSubDomainRequest();
|
|
3635
3664
|
mockUploadWorkerRequest();
|
|
3636
3665
|
await runWrangler("publish --dry-run --outdir dist --define abc:789");
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
})();
|
|
3642
|
-
//# sourceMappingURL=index.js.map
|
|
3643
|
-
"
|
|
3644
|
-
`);
|
|
3666
|
+
|
|
3667
|
+
expect(fs.readFileSync("dist/index.js", "utf-8")).toContain(
|
|
3668
|
+
`console.log(789);`
|
|
3669
|
+
);
|
|
3645
3670
|
});
|
|
3646
3671
|
});
|
|
3647
3672
|
|
|
@@ -3665,12 +3690,12 @@ addEventListener('fetch', event => {});`
|
|
|
3665
3690
|
|
|
3666
3691
|
await runWrangler("publish index.js");
|
|
3667
3692
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3693
|
+
"Running custom build: node -e \\"console.log('custom build'); require('fs').writeFileSync('index.js', 'export default { fetch(){ return new Response(123) } }')\\"
|
|
3694
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
3695
|
+
Uploaded test-name (TIMINGS)
|
|
3696
|
+
Published test-name (TIMINGS)
|
|
3697
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3698
|
+
`);
|
|
3674
3699
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3675
3700
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
3676
3701
|
});
|
|
@@ -3691,7 +3716,7 @@ addEventListener('fetch', event => {});`
|
|
|
3691
3716
|
await runWrangler("publish index.js");
|
|
3692
3717
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3693
3718
|
"Running custom build: echo \\"custom build\\" && echo \\"export default { fetch(){ return new Response(123) } }\\" > index.js
|
|
3694
|
-
Total Upload:
|
|
3719
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
3695
3720
|
Uploaded test-name (TIMINGS)
|
|
3696
3721
|
Published test-name (TIMINGS)
|
|
3697
3722
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3797,7 +3822,7 @@ addEventListener('fetch', event => {});`
|
|
|
3797
3822
|
mockSubDomainRequest();
|
|
3798
3823
|
await runWrangler("publish index.js --minify");
|
|
3799
3824
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3800
|
-
"Total Upload:
|
|
3825
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3801
3826
|
Uploaded test-name (TIMINGS)
|
|
3802
3827
|
Published test-name (TIMINGS)
|
|
3803
3828
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3836,7 +3861,7 @@ addEventListener('fetch', event => {});`
|
|
|
3836
3861
|
mockSubDomainRequest();
|
|
3837
3862
|
await runWrangler("publish -e testEnv index.js");
|
|
3838
3863
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3839
|
-
"Total Upload:
|
|
3864
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3840
3865
|
Uploaded test-name (testEnv) (TIMINGS)
|
|
3841
3866
|
Published test-name (testEnv) (TIMINGS)
|
|
3842
3867
|
https://testEnv.test-name.test-sub-domain.workers.dev"
|
|
@@ -3860,14 +3885,14 @@ addEventListener('fetch', event => {});`
|
|
|
3860
3885
|
mockUploadWorkerRequest();
|
|
3861
3886
|
await runWrangler("publish index.js");
|
|
3862
3887
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3888
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3889
|
+
Your worker has access to the following bindings:
|
|
3890
|
+
- Durable Objects:
|
|
3891
|
+
- SOMENAME: SomeClass
|
|
3892
|
+
Uploaded test-name (TIMINGS)
|
|
3893
|
+
Published test-name (TIMINGS)
|
|
3894
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3895
|
+
`);
|
|
3871
3896
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3872
3897
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
3873
3898
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -3910,14 +3935,14 @@ addEventListener('fetch', event => {});`
|
|
|
3910
3935
|
mockUploadWorkerRequest();
|
|
3911
3936
|
await runWrangler("publish index.js");
|
|
3912
3937
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3938
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3939
|
+
Your worker has access to the following bindings:
|
|
3940
|
+
- Durable Objects:
|
|
3941
|
+
- SOMENAME: SomeClass (defined in some-script)
|
|
3942
|
+
Uploaded test-name (TIMINGS)
|
|
3943
|
+
Published test-name (TIMINGS)
|
|
3944
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3945
|
+
`);
|
|
3921
3946
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3922
3947
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
3923
3948
|
});
|
|
@@ -3953,15 +3978,15 @@ addEventListener('fetch', event => {});`
|
|
|
3953
3978
|
|
|
3954
3979
|
await runWrangler("publish index.js");
|
|
3955
3980
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3981
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3982
|
+
Your worker has access to the following bindings:
|
|
3983
|
+
- Durable Objects:
|
|
3984
|
+
- SOMENAME: SomeClass
|
|
3985
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
3986
|
+
Uploaded test-name (TIMINGS)
|
|
3987
|
+
Published test-name (TIMINGS)
|
|
3988
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3989
|
+
`);
|
|
3965
3990
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3966
3991
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
3967
3992
|
});
|
|
@@ -4001,20 +4026,20 @@ addEventListener('fetch', event => {});`
|
|
|
4001
4026
|
|
|
4002
4027
|
await runWrangler("publish index.js");
|
|
4003
4028
|
expect(std).toMatchInlineSnapshot(`
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4029
|
+
Object {
|
|
4030
|
+
"debug": "",
|
|
4031
|
+
"err": "",
|
|
4032
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4033
|
+
Your worker has access to the following bindings:
|
|
4034
|
+
- Durable Objects:
|
|
4035
|
+
- SOMENAME: SomeClass
|
|
4036
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4037
|
+
Uploaded test-name (TIMINGS)
|
|
4038
|
+
Published test-name (TIMINGS)
|
|
4039
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
4040
|
+
"warn": "",
|
|
4041
|
+
}
|
|
4042
|
+
`);
|
|
4018
4043
|
});
|
|
4019
4044
|
|
|
4020
4045
|
it("should not send migrations if they've all already been sent", async () => {
|
|
@@ -4045,20 +4070,20 @@ addEventListener('fetch', event => {});`
|
|
|
4045
4070
|
|
|
4046
4071
|
await runWrangler("publish index.js");
|
|
4047
4072
|
expect(std).toMatchInlineSnapshot(`
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4073
|
+
Object {
|
|
4074
|
+
"debug": "",
|
|
4075
|
+
"err": "",
|
|
4076
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4077
|
+
Your worker has access to the following bindings:
|
|
4078
|
+
- Durable Objects:
|
|
4079
|
+
- SOMENAME: SomeClass
|
|
4080
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4081
|
+
Uploaded test-name (TIMINGS)
|
|
4082
|
+
Published test-name (TIMINGS)
|
|
4083
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
4084
|
+
"warn": "",
|
|
4085
|
+
}
|
|
4086
|
+
`);
|
|
4062
4087
|
});
|
|
4063
4088
|
|
|
4064
4089
|
describe("service environments", () => {
|
|
@@ -4094,15 +4119,15 @@ addEventListener('fetch', event => {});`
|
|
|
4094
4119
|
|
|
4095
4120
|
await runWrangler("publish index.js --legacy-env false");
|
|
4096
4121
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4122
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4123
|
+
Your worker has access to the following bindings:
|
|
4124
|
+
- Durable Objects:
|
|
4125
|
+
- SOMENAME: SomeClass
|
|
4126
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4127
|
+
Uploaded test-name (TIMINGS)
|
|
4128
|
+
Published test-name (TIMINGS)
|
|
4129
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4130
|
+
`);
|
|
4106
4131
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4107
4132
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
4108
4133
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -4157,15 +4182,15 @@ addEventListener('fetch', event => {});`
|
|
|
4157
4182
|
|
|
4158
4183
|
await runWrangler("publish index.js --legacy-env false --env xyz");
|
|
4159
4184
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4185
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4186
|
+
Your worker has access to the following bindings:
|
|
4187
|
+
- Durable Objects:
|
|
4188
|
+
- SOMENAME: SomeClass
|
|
4189
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4190
|
+
Uploaded test-name (xyz) (TIMINGS)
|
|
4191
|
+
Published test-name (xyz) (TIMINGS)
|
|
4192
|
+
https://xyz.test-name.test-sub-domain.workers.dev"
|
|
4193
|
+
`);
|
|
4169
4194
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4170
4195
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
4171
4196
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -4178,6 +4203,7 @@ addEventListener('fetch', event => {});`
|
|
|
4178
4203
|
});
|
|
4179
4204
|
|
|
4180
4205
|
it("should use a script's current migration tag when publishing migrations", async () => {
|
|
4206
|
+
unsetAllMocks();
|
|
4181
4207
|
writeWranglerToml({
|
|
4182
4208
|
durable_objects: {
|
|
4183
4209
|
bindings: [
|
|
@@ -4213,25 +4239,25 @@ addEventListener('fetch', event => {});`
|
|
|
4213
4239
|
|
|
4214
4240
|
await runWrangler("publish index.js --legacy-env false");
|
|
4215
4241
|
expect(std).toMatchInlineSnapshot(`
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4242
|
+
Object {
|
|
4243
|
+
"debug": "",
|
|
4244
|
+
"err": "",
|
|
4245
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4246
|
+
Your worker has access to the following bindings:
|
|
4247
|
+
- Durable Objects:
|
|
4248
|
+
- SOMENAME: SomeClass
|
|
4249
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4250
|
+
Uploaded test-name (TIMINGS)
|
|
4251
|
+
Published test-name (TIMINGS)
|
|
4252
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
4253
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
4228
4254
|
|
|
4229
|
-
|
|
4230
|
-
|
|
4255
|
+
- Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
|
|
4256
|
+
the future. DO NOT USE IN PRODUCTION.
|
|
4231
4257
|
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4258
|
+
",
|
|
4259
|
+
}
|
|
4260
|
+
`);
|
|
4235
4261
|
});
|
|
4236
4262
|
|
|
4237
4263
|
it("should use an environment's current migration tag when publishing migrations", async () => {
|
|
@@ -4282,25 +4308,25 @@ addEventListener('fetch', event => {});`
|
|
|
4282
4308
|
|
|
4283
4309
|
await runWrangler("publish index.js --legacy-env false --env xyz");
|
|
4284
4310
|
expect(std).toMatchInlineSnapshot(`
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4311
|
+
Object {
|
|
4312
|
+
"debug": "",
|
|
4313
|
+
"err": "",
|
|
4314
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4315
|
+
Your worker has access to the following bindings:
|
|
4316
|
+
- Durable Objects:
|
|
4317
|
+
- SOMENAME: SomeClass
|
|
4318
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4319
|
+
Uploaded test-name (xyz) (TIMINGS)
|
|
4320
|
+
Published test-name (xyz) (TIMINGS)
|
|
4321
|
+
https://xyz.test-name.test-sub-domain.workers.dev",
|
|
4322
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
4297
4323
|
|
|
4298
|
-
|
|
4299
|
-
|
|
4324
|
+
- Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
|
|
4325
|
+
the future. DO NOT USE IN PRODUCTION.
|
|
4300
4326
|
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4327
|
+
",
|
|
4328
|
+
}
|
|
4329
|
+
`);
|
|
4304
4330
|
});
|
|
4305
4331
|
});
|
|
4306
4332
|
});
|
|
@@ -4479,39 +4505,39 @@ addEventListener('fetch', event => {});`
|
|
|
4479
4505
|
|
|
4480
4506
|
await expect(runWrangler("publish index.js")).resolves.toBeUndefined();
|
|
4481
4507
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4508
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4509
|
+
Your worker has access to the following bindings:
|
|
4510
|
+
- Data Blobs:
|
|
4511
|
+
- DATA_BLOB_ONE: some-data-blob.bin
|
|
4512
|
+
- DATA_BLOB_TWO: more-data-blob.bin
|
|
4513
|
+
- Durable Objects:
|
|
4514
|
+
- DURABLE_OBJECT_ONE: SomeDurableObject (defined in some-durable-object-worker)
|
|
4515
|
+
- DURABLE_OBJECT_TWO: AnotherDurableObject (defined in another-durable-object-worker) - staging
|
|
4516
|
+
- KV Namespaces:
|
|
4517
|
+
- KV_NAMESPACE_ONE: kv-ns-one-id
|
|
4518
|
+
- KV_NAMESPACE_TWO: kv-ns-two-id
|
|
4519
|
+
- R2 Buckets:
|
|
4520
|
+
- R2_BUCKET_ONE: r2-bucket-one-name
|
|
4521
|
+
- R2_BUCKET_TWO: r2-bucket-two-name
|
|
4522
|
+
- logfwdr:
|
|
4523
|
+
- httplogs: httplogs
|
|
4524
|
+
- trace: trace
|
|
4525
|
+
- Text Blobs:
|
|
4526
|
+
- TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg
|
|
4527
|
+
- TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt
|
|
4528
|
+
- Unsafe:
|
|
4529
|
+
- some unsafe thing: UNSAFE_BINDING_ONE
|
|
4530
|
+
- another unsafe thing: UNSAFE_BINDING_TWO
|
|
4531
|
+
- Vars:
|
|
4532
|
+
- ENV_VAR_ONE: \\"123\\"
|
|
4533
|
+
- ENV_VAR_TWO: \\"Hello, I'm an environment variable\\"
|
|
4534
|
+
- Wasm Modules:
|
|
4535
|
+
- WASM_MODULE_ONE: some_wasm.wasm
|
|
4536
|
+
- WASM_MODULE_TWO: more_wasm.wasm
|
|
4537
|
+
Uploaded test-name (TIMINGS)
|
|
4538
|
+
Published test-name (TIMINGS)
|
|
4539
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4540
|
+
`);
|
|
4515
4541
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4516
4542
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
4517
4543
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -4884,14 +4910,14 @@ addEventListener('fetch', event => {});`
|
|
|
4884
4910
|
mockSubDomainRequest();
|
|
4885
4911
|
await runWrangler("publish index.js");
|
|
4886
4912
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4913
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4914
|
+
Your worker has access to the following bindings:
|
|
4915
|
+
- Wasm Modules:
|
|
4916
|
+
- TESTWASMNAME: path/to/test.wasm
|
|
4917
|
+
Uploaded test-name (TIMINGS)
|
|
4918
|
+
Published test-name (TIMINGS)
|
|
4919
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4920
|
+
`);
|
|
4895
4921
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4896
4922
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
4897
4923
|
});
|
|
@@ -4954,14 +4980,14 @@ addEventListener('fetch', event => {});`
|
|
|
4954
4980
|
mockSubDomainRequest();
|
|
4955
4981
|
await runWrangler("publish index.js --config ./path/to/wrangler.toml");
|
|
4956
4982
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4983
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4984
|
+
Your worker has access to the following bindings:
|
|
4985
|
+
- Wasm Modules:
|
|
4986
|
+
- TESTWASMNAME: path/to/and/the/path/to/test.wasm
|
|
4987
|
+
Uploaded test-name (TIMINGS)
|
|
4988
|
+
Published test-name (TIMINGS)
|
|
4989
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4990
|
+
`);
|
|
4965
4991
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4966
4992
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
4967
4993
|
});
|
|
@@ -4990,7 +5016,7 @@ addEventListener('fetch', event => {});`
|
|
|
4990
5016
|
mockSubDomainRequest();
|
|
4991
5017
|
await runWrangler("publish index.js");
|
|
4992
5018
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4993
|
-
"Total Upload:
|
|
5019
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4994
5020
|
Uploaded test-name (TIMINGS)
|
|
4995
5021
|
Published test-name (TIMINGS)
|
|
4996
5022
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5024,14 +5050,14 @@ addEventListener('fetch', event => {});`
|
|
|
5024
5050
|
mockSubDomainRequest();
|
|
5025
5051
|
await runWrangler("publish index.js");
|
|
5026
5052
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5053
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5054
|
+
Your worker has access to the following bindings:
|
|
5055
|
+
- Text Blobs:
|
|
5056
|
+
- TESTTEXTBLOBNAME: path/to/text.file
|
|
5057
|
+
Uploaded test-name (TIMINGS)
|
|
5058
|
+
Published test-name (TIMINGS)
|
|
5059
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5060
|
+
`);
|
|
5035
5061
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5036
5062
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5037
5063
|
});
|
|
@@ -5098,14 +5124,14 @@ addEventListener('fetch', event => {});`
|
|
|
5098
5124
|
mockSubDomainRequest();
|
|
5099
5125
|
await runWrangler("publish index.js --config ./path/to/wrangler.toml");
|
|
5100
5126
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5127
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5128
|
+
Your worker has access to the following bindings:
|
|
5129
|
+
- Text Blobs:
|
|
5130
|
+
- TESTTEXTBLOBNAME: path/to/and/the/path/to/text.file
|
|
5131
|
+
Uploaded test-name (TIMINGS)
|
|
5132
|
+
Published test-name (TIMINGS)
|
|
5133
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5134
|
+
`);
|
|
5109
5135
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5110
5136
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5111
5137
|
});
|
|
@@ -5135,14 +5161,14 @@ addEventListener('fetch', event => {});`
|
|
|
5135
5161
|
mockSubDomainRequest();
|
|
5136
5162
|
await runWrangler("publish index.js");
|
|
5137
5163
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5164
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5165
|
+
Your worker has access to the following bindings:
|
|
5166
|
+
- Data Blobs:
|
|
5167
|
+
- TESTDATABLOBNAME: path/to/data.bin
|
|
5168
|
+
Uploaded test-name (TIMINGS)
|
|
5169
|
+
Published test-name (TIMINGS)
|
|
5170
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5171
|
+
`);
|
|
5146
5172
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5147
5173
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5148
5174
|
});
|
|
@@ -5209,14 +5235,14 @@ addEventListener('fetch', event => {});`
|
|
|
5209
5235
|
mockSubDomainRequest();
|
|
5210
5236
|
await runWrangler("publish index.js --config ./path/to/wrangler.toml");
|
|
5211
5237
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5238
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5239
|
+
Your worker has access to the following bindings:
|
|
5240
|
+
- Data Blobs:
|
|
5241
|
+
- TESTDATABLOBNAME: path/to/and/the/path/to/data.bin
|
|
5242
|
+
Uploaded test-name (TIMINGS)
|
|
5243
|
+
Published test-name (TIMINGS)
|
|
5244
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5245
|
+
`);
|
|
5220
5246
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5221
5247
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5222
5248
|
});
|
|
@@ -5247,16 +5273,16 @@ addEventListener('fetch', event => {});`
|
|
|
5247
5273
|
|
|
5248
5274
|
await runWrangler("publish index.js");
|
|
5249
5275
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5276
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5277
|
+
Your worker has access to the following bindings:
|
|
5278
|
+
- Vars:
|
|
5279
|
+
- text: \\"plain ol' string\\"
|
|
5280
|
+
- count: \\"1\\"
|
|
5281
|
+
- complex: \\"[object Object]\\"
|
|
5282
|
+
Uploaded test-name (TIMINGS)
|
|
5283
|
+
Published test-name (TIMINGS)
|
|
5284
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5285
|
+
`);
|
|
5260
5286
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5261
5287
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5262
5288
|
});
|
|
@@ -5271,11 +5297,11 @@ addEventListener('fetch', event => {});`
|
|
|
5271
5297
|
Object {
|
|
5272
5298
|
"debug": "",
|
|
5273
5299
|
"err": "",
|
|
5274
|
-
"out": "
|
|
5300
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
5301
|
+
Your worker has access to the following bindings:
|
|
5275
5302
|
- Vars:
|
|
5276
5303
|
- TEXT: \\"(hidden)\\"
|
|
5277
5304
|
- COUNT: \\"(hidden)\\"
|
|
5278
|
-
Total Upload: 0xx KiB / gzip: 0xx KiB
|
|
5279
5305
|
Uploaded test-name (TIMINGS)
|
|
5280
5306
|
Published test-name (TIMINGS)
|
|
5281
5307
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -5300,14 +5326,14 @@ addEventListener('fetch', event => {});`
|
|
|
5300
5326
|
|
|
5301
5327
|
await runWrangler("publish index.js");
|
|
5302
5328
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5329
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5330
|
+
Your worker has access to the following bindings:
|
|
5331
|
+
- R2 Buckets:
|
|
5332
|
+
- FOO: foo-bucket
|
|
5333
|
+
Uploaded test-name (TIMINGS)
|
|
5334
|
+
Published test-name (TIMINGS)
|
|
5335
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5336
|
+
`);
|
|
5311
5337
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5312
5338
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5313
5339
|
});
|
|
@@ -5351,15 +5377,15 @@ addEventListener('fetch', event => {});`
|
|
|
5351
5377
|
|
|
5352
5378
|
await runWrangler("publish index.js");
|
|
5353
5379
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5380
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5381
|
+
Your worker has access to the following bindings:
|
|
5382
|
+
- logfwdr:
|
|
5383
|
+
- httplogs: httplogs
|
|
5384
|
+
- trace: trace
|
|
5385
|
+
Uploaded test-name (TIMINGS)
|
|
5386
|
+
Published test-name (TIMINGS)
|
|
5387
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5388
|
+
`);
|
|
5363
5389
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5364
5390
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5365
5391
|
});
|
|
@@ -5398,14 +5424,14 @@ addEventListener('fetch', event => {});`
|
|
|
5398
5424
|
|
|
5399
5425
|
await runWrangler("publish index.js");
|
|
5400
5426
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5427
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5428
|
+
Your worker has access to the following bindings:
|
|
5429
|
+
- Durable Objects:
|
|
5430
|
+
- EXAMPLE_DO_BINDING: ExampleDurableObject
|
|
5431
|
+
Uploaded test-name (TIMINGS)
|
|
5432
|
+
Published test-name (TIMINGS)
|
|
5433
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5434
|
+
`);
|
|
5409
5435
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5410
5436
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5411
5437
|
});
|
|
@@ -5438,14 +5464,14 @@ addEventListener('fetch', event => {});`
|
|
|
5438
5464
|
|
|
5439
5465
|
await runWrangler("publish index.js");
|
|
5440
5466
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5467
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5468
|
+
Your worker has access to the following bindings:
|
|
5469
|
+
- Durable Objects:
|
|
5470
|
+
- EXAMPLE_DO_BINDING: ExampleDurableObject (defined in example-do-binding-worker)
|
|
5471
|
+
Uploaded test-name (TIMINGS)
|
|
5472
|
+
Published test-name (TIMINGS)
|
|
5473
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5474
|
+
`);
|
|
5449
5475
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5450
5476
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5451
5477
|
});
|
|
@@ -5483,14 +5509,14 @@ addEventListener('fetch', event => {});`
|
|
|
5483
5509
|
|
|
5484
5510
|
await runWrangler("publish index.js");
|
|
5485
5511
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5512
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5513
|
+
Your worker has access to the following bindings:
|
|
5514
|
+
- Durable Objects:
|
|
5515
|
+
- EXAMPLE_DO_BINDING: ExampleDurableObject
|
|
5516
|
+
Uploaded test-name (TIMINGS)
|
|
5517
|
+
Published test-name (TIMINGS)
|
|
5518
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5519
|
+
`);
|
|
5494
5520
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5495
5521
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5496
5522
|
});
|
|
@@ -5546,14 +5572,14 @@ addEventListener('fetch', event => {});`
|
|
|
5546
5572
|
|
|
5547
5573
|
await runWrangler("publish index.js");
|
|
5548
5574
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5575
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5576
|
+
Your worker has access to the following bindings:
|
|
5577
|
+
- Services:
|
|
5578
|
+
- FOO: foo-service - production
|
|
5579
|
+
Uploaded test-name (TIMINGS)
|
|
5580
|
+
Published test-name (TIMINGS)
|
|
5581
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5582
|
+
`);
|
|
5557
5583
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5558
5584
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5559
5585
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5588,14 +5614,14 @@ addEventListener('fetch', event => {});`
|
|
|
5588
5614
|
});
|
|
5589
5615
|
await runWrangler("publish index.js");
|
|
5590
5616
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5617
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5618
|
+
Your worker has access to the following bindings:
|
|
5619
|
+
- dispatch namespaces:
|
|
5620
|
+
- foo: Foo
|
|
5621
|
+
Uploaded test-name (TIMINGS)
|
|
5622
|
+
Published test-name (TIMINGS)
|
|
5623
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5624
|
+
`);
|
|
5599
5625
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5600
5626
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5601
5627
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5634,14 +5660,14 @@ addEventListener('fetch', event => {});`
|
|
|
5634
5660
|
|
|
5635
5661
|
await runWrangler("publish index.js");
|
|
5636
5662
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5663
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5664
|
+
Your worker has access to the following bindings:
|
|
5665
|
+
- Unsafe:
|
|
5666
|
+
- binding-type: my-binding
|
|
5667
|
+
Uploaded test-name (TIMINGS)
|
|
5668
|
+
Published test-name (TIMINGS)
|
|
5669
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5670
|
+
`);
|
|
5645
5671
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5646
5672
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5647
5673
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5677,14 +5703,14 @@ addEventListener('fetch', event => {});`
|
|
|
5677
5703
|
|
|
5678
5704
|
await runWrangler("publish index.js");
|
|
5679
5705
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5706
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5707
|
+
Your worker has access to the following bindings:
|
|
5708
|
+
- Unsafe:
|
|
5709
|
+
- plain_text: my-binding
|
|
5710
|
+
Uploaded test-name (TIMINGS)
|
|
5711
|
+
Published test-name (TIMINGS)
|
|
5712
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5713
|
+
`);
|
|
5688
5714
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5689
5715
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5690
5716
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5726,7 +5752,7 @@ addEventListener('fetch', event => {});`
|
|
|
5726
5752
|
});
|
|
5727
5753
|
await runWrangler("publish index.js");
|
|
5728
5754
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5729
|
-
"Total Upload:
|
|
5755
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5730
5756
|
Uploaded test-name (TIMINGS)
|
|
5731
5757
|
Published test-name (TIMINGS)
|
|
5732
5758
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5755,7 +5781,7 @@ addEventListener('fetch', event => {});`
|
|
|
5755
5781
|
});
|
|
5756
5782
|
await runWrangler("publish index.js");
|
|
5757
5783
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5758
|
-
"Total Upload:
|
|
5784
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5759
5785
|
Uploaded test-name (TIMINGS)
|
|
5760
5786
|
Published test-name (TIMINGS)
|
|
5761
5787
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5788,7 +5814,7 @@ addEventListener('fetch', event => {});`
|
|
|
5788
5814
|
});
|
|
5789
5815
|
await runWrangler("publish index.js");
|
|
5790
5816
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5791
|
-
"Total Upload:
|
|
5817
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5792
5818
|
Uploaded test-name (TIMINGS)
|
|
5793
5819
|
Published test-name (TIMINGS)
|
|
5794
5820
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5837,7 +5863,7 @@ addEventListener('fetch', event => {});`
|
|
|
5837
5863
|
});
|
|
5838
5864
|
await runWrangler("publish index.js");
|
|
5839
5865
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5840
|
-
"Total Upload:
|
|
5866
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5841
5867
|
Uploaded test-name (TIMINGS)
|
|
5842
5868
|
Published test-name (TIMINGS)
|
|
5843
5869
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5934,7 +5960,7 @@ addEventListener('fetch', event => {});`
|
|
|
5934
5960
|
});
|
|
5935
5961
|
await runWrangler("publish index.js");
|
|
5936
5962
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5937
|
-
"Total Upload:
|
|
5963
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5938
5964
|
Uploaded test-name (TIMINGS)
|
|
5939
5965
|
Published test-name (TIMINGS)
|
|
5940
5966
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5964,7 +5990,7 @@ addEventListener('fetch', event => {});`
|
|
|
5964
5990
|
});
|
|
5965
5991
|
await runWrangler("publish index.js");
|
|
5966
5992
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5967
|
-
"Total Upload:
|
|
5993
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5968
5994
|
Uploaded test-name (TIMINGS)
|
|
5969
5995
|
Published test-name (TIMINGS)
|
|
5970
5996
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5993,7 +6019,7 @@ addEventListener('fetch', event => {});`
|
|
|
5993
6019
|
});
|
|
5994
6020
|
await runWrangler("publish index.js");
|
|
5995
6021
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5996
|
-
"Total Upload:
|
|
6022
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5997
6023
|
Uploaded test-name (TIMINGS)
|
|
5998
6024
|
Published test-name (TIMINGS)
|
|
5999
6025
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -6024,7 +6050,7 @@ addEventListener('fetch', event => {});`
|
|
|
6024
6050
|
});
|
|
6025
6051
|
await runWrangler("publish index.js");
|
|
6026
6052
|
expect(std.out).toMatchInlineSnapshot(`
|
|
6027
|
-
"Total Upload:
|
|
6053
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
6028
6054
|
Uploaded test-name (TIMINGS)
|
|
6029
6055
|
Published test-name (TIMINGS)
|
|
6030
6056
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -6053,7 +6079,7 @@ addEventListener('fetch', event => {});`
|
|
|
6053
6079
|
"publish index.js --compatibility-date 2022-03-17 --name test-name"
|
|
6054
6080
|
);
|
|
6055
6081
|
expect(std.out).toMatchInlineSnapshot(`
|
|
6056
|
-
"Total Upload:
|
|
6082
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
6057
6083
|
Uploaded test-name (TIMINGS)
|
|
6058
6084
|
Published test-name (TIMINGS)
|
|
6059
6085
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -6094,7 +6120,7 @@ addEventListener('fetch', event => {});`
|
|
|
6094
6120
|
Object {
|
|
6095
6121
|
"debug": "",
|
|
6096
6122
|
"err": "",
|
|
6097
|
-
"out": "Total Upload:
|
|
6123
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6098
6124
|
Uploaded test-name (TIMINGS)
|
|
6099
6125
|
Published test-name (TIMINGS)
|
|
6100
6126
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6124,7 +6150,7 @@ addEventListener('fetch', event => {});`
|
|
|
6124
6150
|
Object {
|
|
6125
6151
|
"debug": "",
|
|
6126
6152
|
"err": "",
|
|
6127
|
-
"out": "Total Upload:
|
|
6153
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6128
6154
|
Uploaded test-name (TIMINGS)
|
|
6129
6155
|
Published test-name (TIMINGS)
|
|
6130
6156
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6147,7 +6173,7 @@ addEventListener('fetch', event => {});`
|
|
|
6147
6173
|
Object {
|
|
6148
6174
|
"debug": "",
|
|
6149
6175
|
"err": "",
|
|
6150
|
-
"out": "Total Upload:
|
|
6176
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6151
6177
|
Uploaded test-name (TIMINGS)
|
|
6152
6178
|
Published test-name (TIMINGS)
|
|
6153
6179
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6171,17 +6197,17 @@ addEventListener('fetch', event => {});`
|
|
|
6171
6197
|
process.env.CLOUDFLARE_ACCOUNT_ID = "";
|
|
6172
6198
|
await runWrangler("publish index.js --dry-run");
|
|
6173
6199
|
expect(std).toMatchInlineSnapshot(`
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6200
|
+
Object {
|
|
6201
|
+
"debug": "",
|
|
6202
|
+
"err": "",
|
|
6203
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6204
|
+
Your worker has access to the following bindings:
|
|
6205
|
+
- Durable Objects:
|
|
6206
|
+
- NAME: SomeClass
|
|
6207
|
+
--dry-run: exiting now.",
|
|
6208
|
+
"warn": "",
|
|
6209
|
+
}
|
|
6210
|
+
`);
|
|
6185
6211
|
});
|
|
6186
6212
|
});
|
|
6187
6213
|
|
|
@@ -6194,7 +6220,7 @@ addEventListener('fetch', event => {});`
|
|
|
6194
6220
|
Object {
|
|
6195
6221
|
"debug": "",
|
|
6196
6222
|
"err": "",
|
|
6197
|
-
"out": "Total Upload:
|
|
6223
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6198
6224
|
--dry-run: exiting now.",
|
|
6199
6225
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mEnabling node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.[0m
|
|
6200
6226
|
|
|
@@ -6239,7 +6265,7 @@ addEventListener('fetch', event => {});`
|
|
|
6239
6265
|
Object {
|
|
6240
6266
|
"debug": "",
|
|
6241
6267
|
"err": "",
|
|
6242
|
-
"out": "Total Upload:
|
|
6268
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6243
6269
|
--dry-run: exiting now.",
|
|
6244
6270
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mEnabling node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.[0m
|
|
6245
6271
|
|
|
@@ -6289,7 +6315,7 @@ addEventListener('fetch', event => {});`
|
|
|
6289
6315
|
Object {
|
|
6290
6316
|
"debug": "",
|
|
6291
6317
|
"err": "",
|
|
6292
|
-
"out": "Total Upload:
|
|
6318
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6293
6319
|
Uploaded test-name (TIMINGS)
|
|
6294
6320
|
Published test-name (TIMINGS)
|
|
6295
6321
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6344,7 +6370,7 @@ addEventListener('fetch', event => {});`
|
|
|
6344
6370
|
Object {
|
|
6345
6371
|
"debug": "",
|
|
6346
6372
|
"err": "",
|
|
6347
|
-
"out": "Total Upload:
|
|
6373
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6348
6374
|
|
|
6349
6375
|
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.[0m
|
|
6350
6376
|
|
|
@@ -6462,6 +6488,58 @@ addEventListener('fetch', event => {});`
|
|
|
6462
6488
|
`);
|
|
6463
6489
|
});
|
|
6464
6490
|
});
|
|
6491
|
+
|
|
6492
|
+
it("should publish if the last deployed source check fails", async () => {
|
|
6493
|
+
unsetAllMocks();
|
|
6494
|
+
writeWorkerSource();
|
|
6495
|
+
writeWranglerToml();
|
|
6496
|
+
mockSubDomainRequest();
|
|
6497
|
+
mockUploadWorkerRequest();
|
|
6498
|
+
setMockRawResponse(
|
|
6499
|
+
"/accounts/:accountId/workers/services/:scriptName",
|
|
6500
|
+
"GET",
|
|
6501
|
+
() => {
|
|
6502
|
+
return createFetchResult(null, false, [
|
|
6503
|
+
{ code: 10090, message: "workers.api.error.service_not_found" },
|
|
6504
|
+
]);
|
|
6505
|
+
}
|
|
6506
|
+
);
|
|
6507
|
+
|
|
6508
|
+
await runWrangler("publish index.js");
|
|
6509
|
+
expect(std).toMatchInlineSnapshot(`
|
|
6510
|
+
Object {
|
|
6511
|
+
"debug": "",
|
|
6512
|
+
"err": "",
|
|
6513
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6514
|
+
Uploaded test-name (TIMINGS)
|
|
6515
|
+
Published test-name (TIMINGS)
|
|
6516
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
6517
|
+
"warn": "",
|
|
6518
|
+
}
|
|
6519
|
+
`);
|
|
6520
|
+
});
|
|
6521
|
+
|
|
6522
|
+
it("should not publish if there's any other kind of error when checking deployment source", async () => {
|
|
6523
|
+
unsetAllMocks();
|
|
6524
|
+
writeWorkerSource();
|
|
6525
|
+
writeWranglerToml();
|
|
6526
|
+
mockSubDomainRequest();
|
|
6527
|
+
mockUploadWorkerRequest();
|
|
6528
|
+
setMockRawResponse(
|
|
6529
|
+
"/accounts/:accountId/workers/services/:scriptName",
|
|
6530
|
+
"GET",
|
|
6531
|
+
() => {
|
|
6532
|
+
return createFetchResult(null, false, [
|
|
6533
|
+
{ code: 10000, message: "Authentication error" },
|
|
6534
|
+
]);
|
|
6535
|
+
}
|
|
6536
|
+
);
|
|
6537
|
+
|
|
6538
|
+
await runWrangler("publish index.js");
|
|
6539
|
+
expect(std.err).toContain(
|
|
6540
|
+
`A request to the Cloudflare API (/accounts/some-account-id/workers/services/test-name) failed`
|
|
6541
|
+
);
|
|
6542
|
+
});
|
|
6465
6543
|
});
|
|
6466
6544
|
|
|
6467
6545
|
/** Write mock assets to the file system so they can be uploaded. */
|