wrangler 0.0.0-e33294b0 → 0.0.0-e351afcf
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/bin/wrangler.js +1 -1
- package/miniflare-dist/index.mjs +183 -92
- package/package.json +15 -10
- package/src/__tests__/api-devregistry.test.ts +121 -0
- package/src/__tests__/api.test.ts +27 -5
- package/src/__tests__/configuration.test.ts +294 -18
- package/src/__tests__/constellation.test.ts +371 -0
- package/src/__tests__/d1/execute.test.ts +3 -1
- package/src/__tests__/d1/migrate.test.ts +102 -0
- package/src/__tests__/delete.test.ts +6 -0
- package/src/__tests__/deployments.test.ts +335 -95
- package/src/__tests__/dev.test.tsx +87 -57
- package/src/__tests__/generate.test.ts +3 -4
- package/src/__tests__/guess-worker-format.test.ts +35 -0
- package/src/__tests__/helpers/mock-console.ts +6 -0
- package/src/__tests__/helpers/msw/handlers/deployments.ts +70 -3
- package/src/__tests__/helpers/msw/index.ts +4 -2
- package/src/__tests__/helpers/worker-scripts/parent-worker.js +4 -1
- package/src/__tests__/index.test.ts +14 -6
- package/src/__tests__/init.test.ts +136 -104
- package/src/__tests__/jest.setup.ts +4 -0
- package/src/__tests__/kv.test.ts +9 -9
- package/src/__tests__/logger.test.ts +68 -2
- package/src/__tests__/middleware.scheduled.test.ts +2 -2
- package/src/__tests__/middleware.test.ts +4 -3
- package/src/__tests__/mtls-certificates.test.ts +7 -3
- package/src/__tests__/pages/deployment-list.test.ts +2 -0
- package/src/__tests__/pages/functions-build.test.ts +159 -39
- package/src/__tests__/pages/project-list.test.ts +2 -0
- package/src/__tests__/pages/project-upload.test.ts +43 -24
- package/src/__tests__/pages/publish.test.ts +267 -148
- package/src/__tests__/publish.test.ts +1040 -339
- package/src/__tests__/pubsub.test.ts +3 -0
- package/src/__tests__/queues.test.ts +5 -2
- package/src/__tests__/test-old-node-version.js +3 -3
- package/src/__tests__/traverse-module-graph.test.ts +220 -0
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/type-generation.test.ts +1 -0
- package/src/__tests__/user.test.ts +2 -2
- package/src/__tests__/worker-namespace.test.ts +1 -0
- package/src/api/dev.ts +15 -22
- package/src/api/pages/create-worker-bundle-contents.ts +1 -0
- package/src/api/pages/publish.tsx +64 -61
- package/src/bundle.ts +51 -16
- package/src/config/environment.ts +36 -4
- package/src/config/index.ts +30 -2
- package/src/config/validation-helpers.ts +1 -1
- package/src/config/validation.ts +149 -5
- package/src/constellation/createProject.tsx +51 -0
- package/src/constellation/deleteProject.ts +51 -0
- package/src/constellation/deleteProjectModel.ts +68 -0
- package/src/constellation/index.ts +75 -0
- package/src/constellation/listCatalog.tsx +35 -0
- package/src/constellation/listModel.tsx +41 -0
- package/src/constellation/listProject.tsx +28 -0
- package/src/constellation/listRuntime.tsx +28 -0
- package/src/constellation/options.ts +17 -0
- package/src/constellation/types.ts +17 -0
- package/src/constellation/uploadModel.tsx +64 -0
- package/src/constellation/utils.ts +90 -0
- package/src/create-worker-preview.ts +19 -8
- package/src/create-worker-upload-form.ts +28 -3
- package/src/d1/backups.tsx +19 -15
- package/src/d1/create.tsx +45 -39
- package/src/d1/delete.ts +1 -1
- package/src/d1/execute.tsx +23 -20
- package/src/d1/list.tsx +14 -12
- package/src/d1/migrations/apply.tsx +36 -30
- package/src/d1/migrations/create.tsx +15 -12
- package/src/d1/migrations/helpers.ts +5 -8
- package/src/d1/migrations/list.tsx +10 -7
- package/src/deployments.ts +260 -8
- package/src/dev/dev.tsx +6 -4
- package/src/dev/local.tsx +65 -40
- package/src/dev/start-server.ts +57 -52
- package/src/dev/use-esbuild.ts +59 -52
- package/src/dev/validate-dev-props.ts +9 -0
- package/src/dev-registry.ts +2 -1
- package/src/dev.tsx +38 -18
- package/src/docs/helpers.ts +50 -0
- package/src/docs/index.ts +25 -68
- package/src/entry.ts +19 -9
- package/src/environment-variables/factory.ts +2 -1
- package/src/generate/index.ts +2 -2
- package/src/index.ts +87 -24
- package/src/init.ts +144 -134
- package/src/inspect.ts +16 -1
- package/src/kv/helpers.ts +7 -4
- package/src/logger.ts +23 -4
- package/src/metrics/send-event.ts +2 -1
- package/src/miniflare-cli/assets.ts +8 -7
- package/src/miniflare-cli/index.ts +3 -3
- package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
- package/src/module-collection.ts +92 -26
- package/src/pages/build.ts +290 -100
- package/src/pages/buildFunctions.ts +20 -10
- package/src/pages/deployments.tsx +3 -5
- package/src/pages/dev.ts +44 -26
- package/src/pages/errors.ts +1 -0
- package/src/pages/functions/buildPlugin.ts +57 -34
- package/src/pages/functions/buildWorker.ts +91 -31
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/pages/projects.tsx +2 -5
- package/src/pages/publish.tsx +1 -10
- package/src/pages/upload.tsx +29 -9
- package/src/paths.ts +1 -1
- package/src/publish/index.ts +1 -1
- package/src/publish/publish.ts +29 -34
- package/src/queues/cli/commands/consumer/add.ts +6 -0
- package/src/queues/client.ts +1 -0
- package/src/r2/helpers.ts +1 -0
- package/src/secret/index.ts +2 -1
- package/src/sites.ts +164 -52
- package/src/traverse-module-graph.ts +53 -0
- package/src/type-generation.ts +1 -1
- package/src/user/user.ts +2 -1
- package/src/utils/render.ts +93 -0
- package/src/worker.ts +18 -1
- package/templates/d1-beta-facade.js +5 -2
- package/templates/gitignore +1 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +17 -5
- package/templates/pages-template-plugin.ts +7 -3
- package/templates/tsconfig.init.json +1 -2
- package/templates/tsconfig.tsbuildinfo +1 -1
- package/wrangler-dist/cli.d.ts +552 -16
- package/wrangler-dist/cli.js +32141 -24052
- package/src/__tests__/api-devregistry.test.js +0 -64
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
printBundleSize,
|
|
11
11
|
printOffendingDependencies,
|
|
12
12
|
} from "../bundle-reporter";
|
|
13
|
+
import { logger } from "../logger";
|
|
13
14
|
import { writeAuthConfigFile } from "../user";
|
|
14
15
|
import { mockAccountId, mockApiToken } from "./helpers/mock-account-id";
|
|
15
16
|
import { mockAuthDomain } from "./helpers/mock-auth-domain";
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
createFetchResult,
|
|
33
34
|
msw,
|
|
34
35
|
mswSuccessDeployments,
|
|
35
|
-
|
|
36
|
+
mswSuccessDeploymentScriptMetadata,
|
|
36
37
|
} from "./helpers/msw";
|
|
37
38
|
import { FileReaderSync } from "./helpers/msw/read-file-sync";
|
|
38
39
|
import { runInTempDir } from "./helpers/run-in-tmp";
|
|
@@ -68,6 +69,7 @@ describe("publish", () => {
|
|
|
68
69
|
setIsTTY(true);
|
|
69
70
|
mockLastDeploymentRequest();
|
|
70
71
|
mockDeploymentsListRequest();
|
|
72
|
+
logger.loggerLevel = "log";
|
|
71
73
|
});
|
|
72
74
|
|
|
73
75
|
afterEach(() => {
|
|
@@ -89,7 +91,7 @@ describe("publish", () => {
|
|
|
89
91
|
);
|
|
90
92
|
writeWorkerSource();
|
|
91
93
|
mockSubDomainRequest();
|
|
92
|
-
mockUploadWorkerRequest({ expectedType: "esm"
|
|
94
|
+
mockUploadWorkerRequest({ expectedType: "esm" });
|
|
93
95
|
mockOAuthServerCallback();
|
|
94
96
|
|
|
95
97
|
await runWrangler("publish ./index");
|
|
@@ -98,6 +100,7 @@ describe("publish", () => {
|
|
|
98
100
|
Object {
|
|
99
101
|
"debug": "",
|
|
100
102
|
"err": "",
|
|
103
|
+
"info": "",
|
|
101
104
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
102
105
|
Worker ID: abc12345
|
|
103
106
|
Worker ETag: etag98765
|
|
@@ -137,7 +140,7 @@ describe("publish", () => {
|
|
|
137
140
|
|
|
138
141
|
expect(std.out).toMatchInlineSnapshot(`
|
|
139
142
|
"Attempting to login via OAuth...
|
|
140
|
-
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%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
|
|
143
|
+
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%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20constellation%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
|
|
141
144
|
Successfully logged in.
|
|
142
145
|
Total Upload: xx KiB / gzip: xx KiB
|
|
143
146
|
Uploaded test-name (TIMINGS)
|
|
@@ -177,7 +180,7 @@ describe("publish", () => {
|
|
|
177
180
|
|
|
178
181
|
expect(std.out).toMatchInlineSnapshot(`
|
|
179
182
|
"Attempting to login via OAuth...
|
|
180
|
-
Opening a link in your default browser: https://dash.staging.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%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
|
|
183
|
+
Opening a link in your default browser: https://dash.staging.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%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20constellation%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
|
|
181
184
|
Successfully logged in.
|
|
182
185
|
Total Upload: xx KiB / gzip: xx KiB
|
|
183
186
|
Uploaded test-name (TIMINGS)
|
|
@@ -326,7 +329,7 @@ describe("publish", () => {
|
|
|
326
329
|
await expect(runWrangler("publish index.js")).rejects.toThrowError();
|
|
327
330
|
|
|
328
331
|
expect(std.err).toMatchInlineSnapshot(`
|
|
329
|
-
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mIn a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/api/
|
|
332
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mIn a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.[0m
|
|
330
333
|
|
|
331
334
|
"
|
|
332
335
|
`);
|
|
@@ -617,6 +620,7 @@ describe("publish", () => {
|
|
|
617
620
|
Object {
|
|
618
621
|
"debug": "",
|
|
619
622
|
"err": "",
|
|
623
|
+
"info": "",
|
|
620
624
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
621
625
|
Uploaded test-name (TIMINGS)
|
|
622
626
|
Published test-name (TIMINGS)
|
|
@@ -664,6 +668,7 @@ describe("publish", () => {
|
|
|
664
668
|
Object {
|
|
665
669
|
"debug": "",
|
|
666
670
|
"err": "",
|
|
671
|
+
"info": "",
|
|
667
672
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
668
673
|
Uploaded test-name (TIMINGS)
|
|
669
674
|
Published test-name (TIMINGS)
|
|
@@ -726,6 +731,7 @@ describe("publish", () => {
|
|
|
726
731
|
Object {
|
|
727
732
|
"debug": "",
|
|
728
733
|
"err": "",
|
|
734
|
+
"info": "",
|
|
729
735
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
730
736
|
Uploaded test-name (staging) (TIMINGS)
|
|
731
737
|
Published test-name (staging) (TIMINGS)
|
|
@@ -1337,6 +1343,32 @@ export default{
|
|
|
1337
1343
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
1338
1344
|
});
|
|
1339
1345
|
|
|
1346
|
+
it("should allow cloudflare module import", async () => {
|
|
1347
|
+
writeWranglerToml();
|
|
1348
|
+
fs.writeFileSync(
|
|
1349
|
+
"./index.js",
|
|
1350
|
+
`
|
|
1351
|
+
import { EmailMessage } from "cloudflare:email";
|
|
1352
|
+
export default{
|
|
1353
|
+
fetch(){
|
|
1354
|
+
return new Response("all done");
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
`
|
|
1358
|
+
);
|
|
1359
|
+
mockUploadWorkerRequest();
|
|
1360
|
+
mockSubDomainRequest();
|
|
1361
|
+
await runWrangler("publish index.js");
|
|
1362
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1363
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1364
|
+
Uploaded test-name (TIMINGS)
|
|
1365
|
+
Published test-name (TIMINGS)
|
|
1366
|
+
https://test-name.test-sub-domain.workers.dev
|
|
1367
|
+
Current Deployment ID: Galaxy-Class"
|
|
1368
|
+
`);
|
|
1369
|
+
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1340
1372
|
it("should be able to transpile entry-points in sub-directories (esm)", async () => {
|
|
1341
1373
|
writeWranglerToml();
|
|
1342
1374
|
writeWorkerSource({ basePath: "./src" });
|
|
@@ -1387,6 +1419,7 @@ export default {};`
|
|
|
1387
1419
|
Object {
|
|
1388
1420
|
"debug": "",
|
|
1389
1421
|
"err": "",
|
|
1422
|
+
"info": "",
|
|
1390
1423
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
1391
1424
|
--dry-run: exiting now.",
|
|
1392
1425
|
"warn": "",
|
|
@@ -1420,6 +1453,7 @@ addEventListener('fetch', event => {});`
|
|
|
1420
1453
|
Object {
|
|
1421
1454
|
"debug": "",
|
|
1422
1455
|
"err": "",
|
|
1456
|
+
"info": "",
|
|
1423
1457
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
1424
1458
|
--dry-run: exiting now.",
|
|
1425
1459
|
"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
|
|
@@ -1519,11 +1553,13 @@ addEventListener('fetch', event => {});`
|
|
|
1519
1553
|
Object {
|
|
1520
1554
|
"debug": "",
|
|
1521
1555
|
"err": "",
|
|
1522
|
-
"
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1556
|
+
"info": "Fetching list of already uploaded assets...
|
|
1557
|
+
Building list of assets to upload...
|
|
1558
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
1559
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
1560
|
+
Uploading 2 new assets...
|
|
1561
|
+
Uploaded 100% [2 out of 2]",
|
|
1562
|
+
"out": "↗️ Done syncing assets
|
|
1527
1563
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1528
1564
|
Uploaded test-name (TIMINGS)
|
|
1529
1565
|
Published test-name (TIMINGS)
|
|
@@ -1571,12 +1607,16 @@ addEventListener('fetch', event => {});`
|
|
|
1571
1607
|
mockUploadAssetsToKVRequest(kvNamespace.id, assets);
|
|
1572
1608
|
await runWrangler("publish --config ./my-site/wrangler.toml");
|
|
1573
1609
|
|
|
1610
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
1611
|
+
"Fetching list of already uploaded assets...
|
|
1612
|
+
Building list of assets to upload...
|
|
1613
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
1614
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
1615
|
+
Uploading 2 new assets...
|
|
1616
|
+
Uploaded 100% [2 out of 2]"
|
|
1617
|
+
`);
|
|
1574
1618
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1575
|
-
"
|
|
1576
|
-
Uploading as file-1.2ca234f380.txt...
|
|
1577
|
-
Reading file-2.txt...
|
|
1578
|
-
Uploading as file-2.5938485188.txt...
|
|
1579
|
-
↗️ Done syncing assets
|
|
1619
|
+
"↗️ Done syncing assets
|
|
1580
1620
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1581
1621
|
Uploaded test-name (TIMINGS)
|
|
1582
1622
|
Published test-name (TIMINGS)
|
|
@@ -1649,7 +1689,7 @@ addEventListener('fetch', event => {});`
|
|
|
1649
1689
|
};
|
|
1650
1690
|
writeAssets(assets);
|
|
1651
1691
|
mockUploadWorkerRequest({
|
|
1652
|
-
expectedMainModule: "
|
|
1692
|
+
expectedMainModule: "no-op-worker.js",
|
|
1653
1693
|
});
|
|
1654
1694
|
mockSubDomainRequest();
|
|
1655
1695
|
mockListKVNamespacesRequest(kvNamespace);
|
|
@@ -1662,11 +1702,13 @@ addEventListener('fetch', event => {});`
|
|
|
1662
1702
|
Object {
|
|
1663
1703
|
"debug": "",
|
|
1664
1704
|
"err": "",
|
|
1665
|
-
"
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1705
|
+
"info": "Fetching list of already uploaded assets...
|
|
1706
|
+
Building list of assets to upload...
|
|
1707
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
1708
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
1709
|
+
Uploading 2 new assets...
|
|
1710
|
+
Uploaded 100% [2 out of 2]",
|
|
1711
|
+
"out": "↗️ Done syncing assets
|
|
1670
1712
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1671
1713
|
Uploaded test-name (TIMINGS)
|
|
1672
1714
|
Published test-name (TIMINGS)
|
|
@@ -1710,12 +1752,16 @@ addEventListener('fetch', event => {});`
|
|
|
1710
1752
|
mockUploadAssetsToKVRequest(kvNamespace.id, assets);
|
|
1711
1753
|
await runWrangler("publish");
|
|
1712
1754
|
|
|
1755
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
1756
|
+
"Fetching list of already uploaded assets...
|
|
1757
|
+
Building list of assets to upload...
|
|
1758
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
1759
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
1760
|
+
Uploading 2 new assets...
|
|
1761
|
+
Uploaded 100% [2 out of 2]"
|
|
1762
|
+
`);
|
|
1713
1763
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1714
|
-
"
|
|
1715
|
-
Uploading as file-1.2ca234f380.txt...
|
|
1716
|
-
Reading file-2.txt...
|
|
1717
|
-
Uploading as file-2.5938485188.txt...
|
|
1718
|
-
↗️ Done syncing assets
|
|
1764
|
+
"↗️ Done syncing assets
|
|
1719
1765
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1720
1766
|
Uploaded test-name (TIMINGS)
|
|
1721
1767
|
Published test-name (TIMINGS)
|
|
@@ -1740,7 +1786,7 @@ addEventListener('fetch', event => {});`
|
|
|
1740
1786
|
writeWorkerSource();
|
|
1741
1787
|
writeAssets(assets);
|
|
1742
1788
|
mockUploadWorkerRequest({
|
|
1743
|
-
expectedMainModule: "
|
|
1789
|
+
expectedMainModule: "index.js",
|
|
1744
1790
|
});
|
|
1745
1791
|
mockSubDomainRequest();
|
|
1746
1792
|
mockListKVNamespacesRequest(kvNamespace);
|
|
@@ -1752,11 +1798,13 @@ addEventListener('fetch', event => {});`
|
|
|
1752
1798
|
Object {
|
|
1753
1799
|
"debug": "",
|
|
1754
1800
|
"err": "",
|
|
1755
|
-
"
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1801
|
+
"info": "Fetching list of already uploaded assets...
|
|
1802
|
+
Building list of assets to upload...
|
|
1803
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
1804
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
1805
|
+
Uploading 2 new assets...
|
|
1806
|
+
Uploaded 100% [2 out of 2]",
|
|
1807
|
+
"out": "↗️ Done syncing assets
|
|
1760
1808
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1761
1809
|
Uploaded test-name (TIMINGS)
|
|
1762
1810
|
Published test-name (TIMINGS)
|
|
@@ -1781,18 +1829,19 @@ addEventListener('fetch', event => {});`
|
|
|
1781
1829
|
);
|
|
1782
1830
|
|
|
1783
1831
|
expect(std).toMatchInlineSnapshot(`
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1832
|
+
Object {
|
|
1833
|
+
"debug": "",
|
|
1834
|
+
"err": "[31mX [41;31m[[41;97mERROR[41;31m][0m [1mYou cannot use the service-worker format with an \`assets\` directory yet. For information on how to migrate to the module-worker format, see: https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/[0m
|
|
1787
1835
|
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1836
|
+
",
|
|
1837
|
+
"info": "",
|
|
1838
|
+
"out": "
|
|
1839
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m",
|
|
1840
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mThe --assets argument is experimental and may change or break at any time[0m
|
|
1792
1841
|
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1842
|
+
",
|
|
1843
|
+
}
|
|
1844
|
+
`);
|
|
1796
1845
|
});
|
|
1797
1846
|
|
|
1798
1847
|
it("should error if --assets and --site are used together", async () => {
|
|
@@ -1807,16 +1856,17 @@ addEventListener('fetch', event => {});`
|
|
|
1807
1856
|
);
|
|
1808
1857
|
|
|
1809
1858
|
expect(std).toMatchInlineSnapshot(`
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1859
|
+
Object {
|
|
1860
|
+
"debug": "",
|
|
1861
|
+
"err": "[31mX [41;31m[[41;97mERROR[41;31m][0m [1mCannot use Assets and Workers Sites in the same Worker.[0m
|
|
1862
|
+
|
|
1863
|
+
",
|
|
1864
|
+
"info": "",
|
|
1865
|
+
"out": "
|
|
1866
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m",
|
|
1867
|
+
"warn": "",
|
|
1868
|
+
}
|
|
1869
|
+
`);
|
|
1820
1870
|
});
|
|
1821
1871
|
|
|
1822
1872
|
it("should error if --assets and config.site are used together", async () => {
|
|
@@ -1834,16 +1884,17 @@ addEventListener('fetch', event => {});`
|
|
|
1834
1884
|
);
|
|
1835
1885
|
|
|
1836
1886
|
expect(std).toMatchInlineSnapshot(`
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1887
|
+
Object {
|
|
1888
|
+
"debug": "",
|
|
1889
|
+
"err": "[31mX [41;31m[[41;97mERROR[41;31m][0m [1mCannot use Assets and Workers Sites in the same Worker.[0m
|
|
1890
|
+
|
|
1891
|
+
",
|
|
1892
|
+
"info": "",
|
|
1893
|
+
"out": "
|
|
1894
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m",
|
|
1895
|
+
"warn": "",
|
|
1896
|
+
}
|
|
1897
|
+
`);
|
|
1847
1898
|
});
|
|
1848
1899
|
|
|
1849
1900
|
it("should error if config.assets and --site are used together", async () => {
|
|
@@ -1860,20 +1911,21 @@ addEventListener('fetch', event => {});`
|
|
|
1860
1911
|
);
|
|
1861
1912
|
|
|
1862
1913
|
expect(std).toMatchInlineSnapshot(`
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1914
|
+
Object {
|
|
1915
|
+
"debug": "",
|
|
1916
|
+
"err": "[31mX [41;31m[[41;97mERROR[41;31m][0m [1mCannot use Assets and Workers Sites in the same Worker.[0m
|
|
1866
1917
|
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1918
|
+
",
|
|
1919
|
+
"info": "",
|
|
1920
|
+
"out": "
|
|
1921
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m",
|
|
1922
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
1871
1923
|
|
|
1872
|
-
|
|
1924
|
+
- \\"assets\\" fields are experimental and may change or break at any time.
|
|
1873
1925
|
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1926
|
+
",
|
|
1927
|
+
}
|
|
1928
|
+
`);
|
|
1877
1929
|
});
|
|
1878
1930
|
|
|
1879
1931
|
it("should error if config.assets and config.site are used together", async () => {
|
|
@@ -1893,20 +1945,21 @@ addEventListener('fetch', event => {});`
|
|
|
1893
1945
|
);
|
|
1894
1946
|
|
|
1895
1947
|
expect(std).toMatchInlineSnapshot(`
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1948
|
+
Object {
|
|
1949
|
+
"debug": "",
|
|
1950
|
+
"err": "[31mX [41;31m[[41;97mERROR[41;31m][0m [1mCannot use Assets and Workers Sites in the same Worker.[0m
|
|
1899
1951
|
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1952
|
+
",
|
|
1953
|
+
"info": "",
|
|
1954
|
+
"out": "
|
|
1955
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m",
|
|
1956
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
1904
1957
|
|
|
1905
|
-
|
|
1958
|
+
- \\"assets\\" fields are experimental and may change or break at any time.
|
|
1906
1959
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1960
|
+
",
|
|
1961
|
+
}
|
|
1962
|
+
`);
|
|
1910
1963
|
});
|
|
1911
1964
|
|
|
1912
1965
|
it("should warn if --assets is used", async () => {
|
|
@@ -1925,7 +1978,7 @@ addEventListener('fetch', event => {});`
|
|
|
1925
1978
|
writeWorkerSource();
|
|
1926
1979
|
writeAssets(assets);
|
|
1927
1980
|
mockUploadWorkerRequest({
|
|
1928
|
-
expectedMainModule: "
|
|
1981
|
+
expectedMainModule: "index.js",
|
|
1929
1982
|
});
|
|
1930
1983
|
mockSubDomainRequest();
|
|
1931
1984
|
mockListKVNamespacesRequest(kvNamespace);
|
|
@@ -1937,11 +1990,13 @@ addEventListener('fetch', event => {});`
|
|
|
1937
1990
|
Object {
|
|
1938
1991
|
"debug": "",
|
|
1939
1992
|
"err": "",
|
|
1940
|
-
"
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1993
|
+
"info": "Fetching list of already uploaded assets...
|
|
1994
|
+
Building list of assets to upload...
|
|
1995
|
+
+ subdir/file-1.2ca234f380.txt (uploading new version of subdir/file-1.txt)
|
|
1996
|
+
+ subdir/file-2.5938485188.txt (uploading new version of subdir/file-2.txt)
|
|
1997
|
+
Uploading 2 new assets...
|
|
1998
|
+
Uploaded 100% [2 out of 2]",
|
|
1999
|
+
"out": "↗️ Done syncing assets
|
|
1945
2000
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1946
2001
|
Uploaded test-name (TIMINGS)
|
|
1947
2002
|
Published test-name (TIMINGS)
|
|
@@ -1972,7 +2027,7 @@ addEventListener('fetch', event => {});`
|
|
|
1972
2027
|
writeWorkerSource();
|
|
1973
2028
|
writeAssets(assets);
|
|
1974
2029
|
mockUploadWorkerRequest({
|
|
1975
|
-
expectedMainModule: "
|
|
2030
|
+
expectedMainModule: "index.js",
|
|
1976
2031
|
});
|
|
1977
2032
|
mockSubDomainRequest();
|
|
1978
2033
|
mockListKVNamespacesRequest(kvNamespace);
|
|
@@ -1984,11 +2039,13 @@ addEventListener('fetch', event => {});`
|
|
|
1984
2039
|
Object {
|
|
1985
2040
|
"debug": "",
|
|
1986
2041
|
"err": "",
|
|
1987
|
-
"
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2042
|
+
"info": "Fetching list of already uploaded assets...
|
|
2043
|
+
Building list of assets to upload...
|
|
2044
|
+
+ subdir/file-1.2ca234f380.txt (uploading new version of subdir/file-1.txt)
|
|
2045
|
+
+ subdir/file-2.5938485188.txt (uploading new version of subdir/file-2.txt)
|
|
2046
|
+
Uploading 2 new assets...
|
|
2047
|
+
Uploaded 100% [2 out of 2]",
|
|
2048
|
+
"out": "↗️ Done syncing assets
|
|
1992
2049
|
Total Upload: xx KiB / gzip: xx KiB
|
|
1993
2050
|
Uploaded test-name (TIMINGS)
|
|
1994
2051
|
Published test-name (TIMINGS)
|
|
@@ -2040,12 +2097,16 @@ addEventListener('fetch', event => {});`
|
|
|
2040
2097
|
|
|
2041
2098
|
await runWrangler("publish");
|
|
2042
2099
|
|
|
2100
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2101
|
+
"Fetching list of already uploaded assets...
|
|
2102
|
+
Building list of assets to upload...
|
|
2103
|
+
+ subdir/file-1.2ca234f380.txt (uploading new version of subdir/file-1.txt)
|
|
2104
|
+
+ subdir/file-2.5938485188.txt (uploading new version of subdir/file-2.txt)
|
|
2105
|
+
Uploading 2 new assets...
|
|
2106
|
+
Uploaded 100% [2 out of 2]"
|
|
2107
|
+
`);
|
|
2043
2108
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2044
|
-
"
|
|
2045
|
-
Uploading as subdir/file-1.2ca234f380.txt...
|
|
2046
|
-
Reading subdir/file-2.txt...
|
|
2047
|
-
Uploading as subdir/file-2.5938485188.txt...
|
|
2048
|
-
↗️ Done syncing assets
|
|
2109
|
+
"↗️ Done syncing assets
|
|
2049
2110
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2050
2111
|
Uploaded test-name (TIMINGS)
|
|
2051
2112
|
Published test-name (TIMINGS)
|
|
@@ -2098,12 +2159,16 @@ addEventListener('fetch', event => {});`
|
|
|
2098
2159
|
|
|
2099
2160
|
await runWrangler("publish");
|
|
2100
2161
|
|
|
2162
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2163
|
+
"Fetching list of already uploaded assets...
|
|
2164
|
+
Building list of assets to upload...
|
|
2165
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2166
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
2167
|
+
Uploading 2 new assets...
|
|
2168
|
+
Uploaded 100% [2 out of 2]"
|
|
2169
|
+
`);
|
|
2101
2170
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2102
|
-
"
|
|
2103
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2104
|
-
Reading file-2.txt...
|
|
2105
|
-
Uploading as file-2.5938485188.txt...
|
|
2106
|
-
↗️ Done syncing assets
|
|
2171
|
+
"↗️ Done syncing assets
|
|
2107
2172
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2108
2173
|
Uploaded test-name (TIMINGS)
|
|
2109
2174
|
Published test-name (TIMINGS)
|
|
@@ -2150,12 +2215,16 @@ addEventListener('fetch', event => {});`
|
|
|
2150
2215
|
|
|
2151
2216
|
await runWrangler("publish");
|
|
2152
2217
|
|
|
2218
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2219
|
+
"Fetching list of already uploaded assets...
|
|
2220
|
+
Building list of assets to upload...
|
|
2221
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2222
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
2223
|
+
Uploading 2 new assets...
|
|
2224
|
+
Uploaded 100% [2 out of 2]"
|
|
2225
|
+
`);
|
|
2153
2226
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2154
|
-
"
|
|
2155
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2156
|
-
Reading file-2.txt...
|
|
2157
|
-
Uploading as file-2.5938485188.txt...
|
|
2158
|
-
↗️ Done syncing assets
|
|
2227
|
+
"↗️ Done syncing assets
|
|
2159
2228
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2160
2229
|
Uploaded test-name (TIMINGS)
|
|
2161
2230
|
Published test-name (TIMINGS)
|
|
@@ -2200,12 +2269,16 @@ addEventListener('fetch', event => {});`
|
|
|
2200
2269
|
mockUploadAssetsToKVRequest(kvNamespace.id, assets);
|
|
2201
2270
|
await runWrangler("publish --env some-env --legacy-env false");
|
|
2202
2271
|
|
|
2272
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2273
|
+
"Fetching list of already uploaded assets...
|
|
2274
|
+
Building list of assets to upload...
|
|
2275
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2276
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
2277
|
+
Uploading 2 new assets...
|
|
2278
|
+
Uploaded 100% [2 out of 2]"
|
|
2279
|
+
`);
|
|
2203
2280
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2204
|
-
"
|
|
2205
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2206
|
-
Reading file-2.txt...
|
|
2207
|
-
Uploading as file-2.5938485188.txt...
|
|
2208
|
-
↗️ Done syncing assets
|
|
2281
|
+
"↗️ Done syncing assets
|
|
2209
2282
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2210
2283
|
Uploaded test-name (some-env) (TIMINGS)
|
|
2211
2284
|
Published test-name (some-env) (TIMINGS)
|
|
@@ -2251,12 +2324,16 @@ addEventListener('fetch', event => {});`
|
|
|
2251
2324
|
mockUploadAssetsToKVRequest(kvNamespace.id, assets);
|
|
2252
2325
|
await runWrangler("publish --env some-env --legacy-env true");
|
|
2253
2326
|
|
|
2327
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2328
|
+
"Fetching list of already uploaded assets...
|
|
2329
|
+
Building list of assets to upload...
|
|
2330
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2331
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
2332
|
+
Uploading 2 new assets...
|
|
2333
|
+
Uploaded 100% [2 out of 2]"
|
|
2334
|
+
`);
|
|
2254
2335
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2255
|
-
"
|
|
2256
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2257
|
-
Reading file-2.txt...
|
|
2258
|
-
Uploading as file-2.5938485188.txt...
|
|
2259
|
-
↗️ Done syncing assets
|
|
2336
|
+
"↗️ Done syncing assets
|
|
2260
2337
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2261
2338
|
Uploaded test-name-some-env (TIMINGS)
|
|
2262
2339
|
Published test-name-some-env (TIMINGS)
|
|
@@ -2296,11 +2373,7 @@ addEventListener('fetch', event => {});`
|
|
|
2296
2373
|
await runWrangler("publish");
|
|
2297
2374
|
|
|
2298
2375
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2299
|
-
"
|
|
2300
|
-
Skipping - already uploaded.
|
|
2301
|
-
Reading file-2.txt...
|
|
2302
|
-
Uploading as file-2.5938485188.txt...
|
|
2303
|
-
↗️ Done syncing assets
|
|
2376
|
+
"↗️ Done syncing assets
|
|
2304
2377
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2305
2378
|
Uploaded test-name (TIMINGS)
|
|
2306
2379
|
Published test-name (TIMINGS)
|
|
@@ -2338,10 +2411,15 @@ addEventListener('fetch', event => {});`
|
|
|
2338
2411
|
);
|
|
2339
2412
|
await runWrangler("publish --site-include file-1.txt");
|
|
2340
2413
|
|
|
2414
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2415
|
+
"Fetching list of already uploaded assets...
|
|
2416
|
+
Building list of assets to upload...
|
|
2417
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2418
|
+
Uploading 1 new asset...
|
|
2419
|
+
Uploaded 100% [1 out of 1]"
|
|
2420
|
+
`);
|
|
2341
2421
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2342
|
-
"
|
|
2343
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2344
|
-
↗️ Done syncing assets
|
|
2422
|
+
"↗️ Done syncing assets
|
|
2345
2423
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2346
2424
|
Uploaded test-name (TIMINGS)
|
|
2347
2425
|
Published test-name (TIMINGS)
|
|
@@ -2379,10 +2457,15 @@ addEventListener('fetch', event => {});`
|
|
|
2379
2457
|
);
|
|
2380
2458
|
await runWrangler("publish --site-exclude file-2.txt");
|
|
2381
2459
|
|
|
2460
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2461
|
+
"Fetching list of already uploaded assets...
|
|
2462
|
+
Building list of assets to upload...
|
|
2463
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2464
|
+
Uploading 1 new asset...
|
|
2465
|
+
Uploaded 100% [1 out of 1]"
|
|
2466
|
+
`);
|
|
2382
2467
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2383
|
-
"
|
|
2384
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2385
|
-
↗️ Done syncing assets
|
|
2468
|
+
"↗️ Done syncing assets
|
|
2386
2469
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2387
2470
|
Uploaded test-name (TIMINGS)
|
|
2388
2471
|
Published test-name (TIMINGS)
|
|
@@ -2421,10 +2504,15 @@ addEventListener('fetch', event => {});`
|
|
|
2421
2504
|
);
|
|
2422
2505
|
await runWrangler("publish");
|
|
2423
2506
|
|
|
2507
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2508
|
+
"Fetching list of already uploaded assets...
|
|
2509
|
+
Building list of assets to upload...
|
|
2510
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2511
|
+
Uploading 1 new asset...
|
|
2512
|
+
Uploaded 100% [1 out of 1]"
|
|
2513
|
+
`);
|
|
2424
2514
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2425
|
-
"
|
|
2426
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2427
|
-
↗️ Done syncing assets
|
|
2515
|
+
"↗️ Done syncing assets
|
|
2428
2516
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2429
2517
|
Uploaded test-name (TIMINGS)
|
|
2430
2518
|
Published test-name (TIMINGS)
|
|
@@ -2463,10 +2551,15 @@ addEventListener('fetch', event => {});`
|
|
|
2463
2551
|
);
|
|
2464
2552
|
await runWrangler("publish");
|
|
2465
2553
|
|
|
2554
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2555
|
+
"Fetching list of already uploaded assets...
|
|
2556
|
+
Building list of assets to upload...
|
|
2557
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2558
|
+
Uploading 1 new asset...
|
|
2559
|
+
Uploaded 100% [1 out of 1]"
|
|
2560
|
+
`);
|
|
2466
2561
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2467
|
-
"
|
|
2468
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2469
|
-
↗️ Done syncing assets
|
|
2562
|
+
"↗️ Done syncing assets
|
|
2470
2563
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2471
2564
|
Uploaded test-name (TIMINGS)
|
|
2472
2565
|
Published test-name (TIMINGS)
|
|
@@ -2505,10 +2598,15 @@ addEventListener('fetch', event => {});`
|
|
|
2505
2598
|
);
|
|
2506
2599
|
await runWrangler("publish --site-include file-1.txt");
|
|
2507
2600
|
|
|
2601
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2602
|
+
"Fetching list of already uploaded assets...
|
|
2603
|
+
Building list of assets to upload...
|
|
2604
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2605
|
+
Uploading 1 new asset...
|
|
2606
|
+
Uploaded 100% [1 out of 1]"
|
|
2607
|
+
`);
|
|
2508
2608
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2509
|
-
"
|
|
2510
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2511
|
-
↗️ Done syncing assets
|
|
2609
|
+
"↗️ Done syncing assets
|
|
2512
2610
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2513
2611
|
Uploaded test-name (TIMINGS)
|
|
2514
2612
|
Published test-name (TIMINGS)
|
|
@@ -2547,10 +2645,15 @@ addEventListener('fetch', event => {});`
|
|
|
2547
2645
|
);
|
|
2548
2646
|
await runWrangler("publish --site-exclude file-2.txt");
|
|
2549
2647
|
|
|
2648
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2649
|
+
"Fetching list of already uploaded assets...
|
|
2650
|
+
Building list of assets to upload...
|
|
2651
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
2652
|
+
Uploading 1 new asset...
|
|
2653
|
+
Uploaded 100% [1 out of 1]"
|
|
2654
|
+
`);
|
|
2550
2655
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2551
|
-
"
|
|
2552
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2553
|
-
↗️ Done syncing assets
|
|
2656
|
+
"↗️ Done syncing assets
|
|
2554
2657
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2555
2658
|
Uploaded test-name (TIMINGS)
|
|
2556
2659
|
Published test-name (TIMINGS)
|
|
@@ -2591,10 +2694,15 @@ addEventListener('fetch', event => {});`
|
|
|
2591
2694
|
mockUploadAssetsToKVRequest(kvNamespace.id, assets.slice(0, 1));
|
|
2592
2695
|
await runWrangler("publish");
|
|
2593
2696
|
|
|
2697
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2698
|
+
"Fetching list of already uploaded assets...
|
|
2699
|
+
Building list of assets to upload...
|
|
2700
|
+
+ directory-1/file-1.2ca234f380.txt (uploading new version of directory-1/file-1.txt)
|
|
2701
|
+
Uploading 1 new asset...
|
|
2702
|
+
Uploaded 100% [1 out of 1]"
|
|
2703
|
+
`);
|
|
2594
2704
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2595
|
-
"
|
|
2596
|
-
Uploading as directory-1/file-1.2ca234f380.txt...
|
|
2597
|
-
↗️ Done syncing assets
|
|
2705
|
+
"↗️ Done syncing assets
|
|
2598
2706
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2599
2707
|
Uploaded test-name (TIMINGS)
|
|
2600
2708
|
Published test-name (TIMINGS)
|
|
@@ -2639,10 +2747,15 @@ addEventListener('fetch', event => {});`
|
|
|
2639
2747
|
mockUploadAssetsToKVRequest(kvNamespace.id, assets.slice(2));
|
|
2640
2748
|
await runWrangler("publish");
|
|
2641
2749
|
|
|
2750
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2751
|
+
"Fetching list of already uploaded assets...
|
|
2752
|
+
Building list of assets to upload...
|
|
2753
|
+
+ .well-known/file-2.5938485188.txt (uploading new version of .well-known/file-2.txt)
|
|
2754
|
+
Uploading 1 new asset...
|
|
2755
|
+
Uploaded 100% [1 out of 1]"
|
|
2756
|
+
`);
|
|
2642
2757
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2643
|
-
"
|
|
2644
|
-
Uploading as .well-known/file-2.5938485188.txt...
|
|
2645
|
-
↗️ Done syncing assets
|
|
2758
|
+
"↗️ Done syncing assets
|
|
2646
2759
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2647
2760
|
Uploaded test-name (TIMINGS)
|
|
2648
2761
|
Published test-name (TIMINGS)
|
|
@@ -2688,13 +2801,15 @@ addEventListener('fetch', event => {});`
|
|
|
2688
2801
|
`"File too-large-file.txt is too big, it should be under 25 MiB. See https://developers.cloudflare.com/workers/platform/limits#kv-limits"`
|
|
2689
2802
|
);
|
|
2690
2803
|
|
|
2804
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2805
|
+
"Fetching list of already uploaded assets...
|
|
2806
|
+
Building list of assets to upload...
|
|
2807
|
+
+ large-file.0ea0637a45.txt (uploading new version of large-file.txt)"
|
|
2808
|
+
`);
|
|
2691
2809
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
2697
|
-
`);
|
|
2810
|
+
"
|
|
2811
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
2812
|
+
`);
|
|
2698
2813
|
expect(std.err).toMatchInlineSnapshot(`
|
|
2699
2814
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mFile too-large-file.txt is too big, it should be under 25 MiB. See https://developers.cloudflare.com/workers/platform/limits#kv-limits[0m
|
|
2700
2815
|
|
|
@@ -2730,7 +2845,9 @@ addEventListener('fetch', event => {});`
|
|
|
2730
2845
|
await runWrangler("publish");
|
|
2731
2846
|
|
|
2732
2847
|
// We expect this to be uploaded in 4 batches
|
|
2733
|
-
|
|
2848
|
+
expect(requests.length).toEqual(4);
|
|
2849
|
+
// Buckets may be uploaded in any order, so sort them before we assert
|
|
2850
|
+
requests.sort((a, b) => a.uploads[0].key.localeCompare(b.uploads[0].key));
|
|
2734
2851
|
// The first batch has 11 files
|
|
2735
2852
|
expect(requests[0].uploads.length).toEqual(11);
|
|
2736
2853
|
// The next batch has 5 files
|
|
@@ -2748,59 +2865,49 @@ addEventListener('fetch', event => {});`
|
|
|
2748
2865
|
}
|
|
2749
2866
|
}
|
|
2750
2867
|
|
|
2751
|
-
expect(std).toMatchInlineSnapshot(`
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
"err": "",
|
|
2755
|
-
"out": "Reading file-00.txt...
|
|
2756
|
-
Uploading as file-00.be5be5dd26.txt...
|
|
2757
|
-
Reading file-01.txt...
|
|
2758
|
-
Uploading as file-01.4842d35994.txt...
|
|
2759
|
-
Reading file-02.txt...
|
|
2760
|
-
Uploading as file-02.990572ec63.txt...
|
|
2761
|
-
Reading file-03.txt...
|
|
2762
|
-
Uploading as file-03.9d7dda9045.txt...
|
|
2763
|
-
Reading file-04.txt...
|
|
2764
|
-
Uploading as file-04.2b6fac6382.txt...
|
|
2765
|
-
Reading file-05.txt...
|
|
2766
|
-
Uploading as file-05.55762dc758.txt...
|
|
2767
|
-
Reading file-06.txt...
|
|
2768
|
-
Uploading as file-06.f408a6b020.txt...
|
|
2769
|
-
Reading file-07.txt...
|
|
2770
|
-
Uploading as file-07.64c051715b.txt...
|
|
2771
|
-
Reading file-08.txt...
|
|
2772
|
-
Uploading as file-08.d286789adb.txt...
|
|
2773
|
-
Reading file-09.txt...
|
|
2774
|
-
Uploading as file-09.6838c183a8.txt...
|
|
2775
|
-
Reading file-10.txt...
|
|
2776
|
-
Uploading as file-10.6e03221d2a.txt...
|
|
2777
|
-
Reading file-11.txt...
|
|
2778
|
-
Uploading as file-11.37d3fb2eff.txt...
|
|
2779
|
-
Reading file-12.txt...
|
|
2780
|
-
Uploading as file-12.b3556942f8.txt...
|
|
2781
|
-
Reading file-13.txt...
|
|
2782
|
-
Uploading as file-13.680caf51b1.txt...
|
|
2783
|
-
Reading file-14.txt...
|
|
2784
|
-
Uploading as file-14.51e88468f0.txt...
|
|
2785
|
-
Reading file-15.txt...
|
|
2786
|
-
Uploading as file-15.8e3fedb394.txt...
|
|
2787
|
-
Reading file-16.txt...
|
|
2788
|
-
Uploading as file-16.c81c5e426f.txt...
|
|
2789
|
-
Reading file-17.txt...
|
|
2790
|
-
Uploading as file-17.4b2ae3c47b.txt...
|
|
2791
|
-
Reading file-18.txt...
|
|
2792
|
-
Uploading as file-18.07f245e02b.txt...
|
|
2793
|
-
Reading file-19.txt...
|
|
2794
|
-
Uploading as file-19.f0d69f705d.txt...
|
|
2795
|
-
↗️ Done syncing assets
|
|
2868
|
+
expect(std.debug).toMatchInlineSnapshot(`""`);
|
|
2869
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
2870
|
+
"↗️ Done syncing assets
|
|
2796
2871
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2797
2872
|
Uploaded test-name (TIMINGS)
|
|
2798
2873
|
Published test-name (TIMINGS)
|
|
2799
2874
|
https://test-name.test-sub-domain.workers.dev
|
|
2800
|
-
Current Deployment ID: Galaxy-Class"
|
|
2801
|
-
"warn": "",
|
|
2802
|
-
}
|
|
2875
|
+
Current Deployment ID: Galaxy-Class"
|
|
2803
2876
|
`);
|
|
2877
|
+
// Mask all but last upload progress message as upload order unknown
|
|
2878
|
+
// (regexp replaces all single/double-digit percentages, i.e. not 100%)
|
|
2879
|
+
expect(std.info.replace(/Uploaded \d\d?% \[\d+/g, "Uploaded X% [X"))
|
|
2880
|
+
.toMatchInlineSnapshot(`
|
|
2881
|
+
"Fetching list of already uploaded assets...
|
|
2882
|
+
Building list of assets to upload...
|
|
2883
|
+
+ file-00.be5be5dd26.txt (uploading new version of file-00.txt)
|
|
2884
|
+
+ file-01.4842d35994.txt (uploading new version of file-01.txt)
|
|
2885
|
+
+ file-02.990572ec63.txt (uploading new version of file-02.txt)
|
|
2886
|
+
+ file-03.9d7dda9045.txt (uploading new version of file-03.txt)
|
|
2887
|
+
+ file-04.2b6fac6382.txt (uploading new version of file-04.txt)
|
|
2888
|
+
+ file-05.55762dc758.txt (uploading new version of file-05.txt)
|
|
2889
|
+
+ file-06.f408a6b020.txt (uploading new version of file-06.txt)
|
|
2890
|
+
+ file-07.64c051715b.txt (uploading new version of file-07.txt)
|
|
2891
|
+
+ file-08.d286789adb.txt (uploading new version of file-08.txt)
|
|
2892
|
+
+ file-09.6838c183a8.txt (uploading new version of file-09.txt)
|
|
2893
|
+
+ file-10.6e03221d2a.txt (uploading new version of file-10.txt)
|
|
2894
|
+
+ file-11.37d3fb2eff.txt (uploading new version of file-11.txt)
|
|
2895
|
+
+ file-12.b3556942f8.txt (uploading new version of file-12.txt)
|
|
2896
|
+
+ file-13.680caf51b1.txt (uploading new version of file-13.txt)
|
|
2897
|
+
+ file-14.51e88468f0.txt (uploading new version of file-14.txt)
|
|
2898
|
+
+ file-15.8e3fedb394.txt (uploading new version of file-15.txt)
|
|
2899
|
+
+ file-16.c81c5e426f.txt (uploading new version of file-16.txt)
|
|
2900
|
+
+ file-17.4b2ae3c47b.txt (uploading new version of file-17.txt)
|
|
2901
|
+
+ file-18.07f245e02b.txt (uploading new version of file-18.txt)
|
|
2902
|
+
+ file-19.f0d69f705d.txt (uploading new version of file-19.txt)
|
|
2903
|
+
Uploading 20 new assets...
|
|
2904
|
+
Uploaded X% [X out of 20]
|
|
2905
|
+
Uploaded X% [X out of 20]
|
|
2906
|
+
Uploaded X% [X out of 20]
|
|
2907
|
+
Uploaded 100% [20 out of 20]"
|
|
2908
|
+
`);
|
|
2909
|
+
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
2910
|
+
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
2804
2911
|
});
|
|
2805
2912
|
|
|
2806
2913
|
it("should error if the asset key is over 512 characters", async () => {
|
|
@@ -2831,11 +2938,14 @@ addEventListener('fetch', event => {});`
|
|
|
2831
2938
|
`"The asset path key \\"folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/file.3da0d0cd12.txt\\" exceeds the maximum key size limit of 512. See https://developers.cloudflare.com/workers/platform/limits#kv-limits\\","`
|
|
2832
2939
|
);
|
|
2833
2940
|
|
|
2941
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2942
|
+
"Fetching list of already uploaded assets...
|
|
2943
|
+
Building list of assets to upload..."
|
|
2944
|
+
`);
|
|
2834
2945
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
`);
|
|
2946
|
+
"
|
|
2947
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
2948
|
+
`);
|
|
2839
2949
|
expect(std.err).toMatchInlineSnapshot(`
|
|
2840
2950
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mThe asset path key \\"folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/file.3da0d0cd12.txt\\" exceeds the maximum key size limit of 512. See https://developers.cloudflare.com/workers/platform/limits#kv-limits\\",[0m
|
|
2841
2951
|
|
|
@@ -2885,14 +2995,20 @@ addEventListener('fetch', event => {});`
|
|
|
2885
2995
|
|
|
2886
2996
|
await runWrangler("publish");
|
|
2887
2997
|
|
|
2998
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
2999
|
+
"Fetching list of already uploaded assets...
|
|
3000
|
+
Building list of assets to upload...
|
|
3001
|
+
= file-1.2ca234f380.txt (already uploaded file-1.txt)
|
|
3002
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
3003
|
+
- file-3.somehash.txt (removing as stale)
|
|
3004
|
+
- file-4.anotherhash.txt (removing as stale)
|
|
3005
|
+
Uploading 1 new asset...
|
|
3006
|
+
Skipped uploading 1 existing asset.
|
|
3007
|
+
Uploaded 100% [1 out of 1]
|
|
3008
|
+
Removing 2 stale assets..."
|
|
3009
|
+
`);
|
|
2888
3010
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2889
|
-
"
|
|
2890
|
-
Skipping - already uploaded.
|
|
2891
|
-
Reading file-2.txt...
|
|
2892
|
-
Uploading as file-2.5938485188.txt...
|
|
2893
|
-
Deleting file-3.somehash.txt from the asset store...
|
|
2894
|
-
Deleting file-4.anotherhash.txt from the asset store...
|
|
2895
|
-
↗️ Done syncing assets
|
|
3011
|
+
"↗️ Done syncing assets
|
|
2896
3012
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2897
3013
|
Uploaded test-name (TIMINGS)
|
|
2898
3014
|
Published test-name (TIMINGS)
|
|
@@ -2942,12 +3058,16 @@ addEventListener('fetch', event => {});`
|
|
|
2942
3058
|
await runWrangler("publish");
|
|
2943
3059
|
process.chdir("../");
|
|
2944
3060
|
|
|
3061
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
3062
|
+
"Fetching list of already uploaded assets...
|
|
3063
|
+
Building list of assets to upload...
|
|
3064
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
3065
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
3066
|
+
Uploading 2 new assets...
|
|
3067
|
+
Uploaded 100% [2 out of 2]"
|
|
3068
|
+
`);
|
|
2945
3069
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2946
|
-
"
|
|
2947
|
-
Uploading as file-1.2ca234f380.txt...
|
|
2948
|
-
Reading file-2.txt...
|
|
2949
|
-
Uploading as file-2.5938485188.txt...
|
|
2950
|
-
↗️ Done syncing assets
|
|
3070
|
+
"↗️ Done syncing assets
|
|
2951
3071
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2952
3072
|
Uploaded test-name (TIMINGS)
|
|
2953
3073
|
Published test-name (TIMINGS)
|
|
@@ -2985,11 +3105,13 @@ addEventListener('fetch', event => {});`
|
|
|
2985
3105
|
Object {
|
|
2986
3106
|
"debug": "",
|
|
2987
3107
|
"err": "",
|
|
2988
|
-
"
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
3108
|
+
"info": "Fetching list of already uploaded assets...
|
|
3109
|
+
Building list of assets to upload...
|
|
3110
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
3111
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
3112
|
+
Uploading 2 new assets...
|
|
3113
|
+
Uploaded 100% [2 out of 2]",
|
|
3114
|
+
"out": "↗️ Done syncing assets
|
|
2993
3115
|
Total Upload: xx KiB / gzip: xx KiB
|
|
2994
3116
|
Uploaded test-name (TIMINGS)
|
|
2995
3117
|
Published test-name (TIMINGS)
|
|
@@ -3015,7 +3137,7 @@ addEventListener('fetch', event => {});`
|
|
|
3015
3137
|
writeWorkerSource();
|
|
3016
3138
|
writeAssets(assets, "my-assets");
|
|
3017
3139
|
mockUploadWorkerRequest({
|
|
3018
|
-
expectedMainModule: "
|
|
3140
|
+
expectedMainModule: "index.js",
|
|
3019
3141
|
});
|
|
3020
3142
|
mockSubDomainRequest();
|
|
3021
3143
|
mockListKVNamespacesRequest(kvNamespace);
|
|
@@ -3028,11 +3150,13 @@ addEventListener('fetch', event => {});`
|
|
|
3028
3150
|
Object {
|
|
3029
3151
|
"debug": "",
|
|
3030
3152
|
"err": "",
|
|
3031
|
-
"
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3153
|
+
"info": "Fetching list of already uploaded assets...
|
|
3154
|
+
Building list of assets to upload...
|
|
3155
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
3156
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
3157
|
+
Uploading 2 new assets...
|
|
3158
|
+
Uploaded 100% [2 out of 2]",
|
|
3159
|
+
"out": "↗️ Done syncing assets
|
|
3036
3160
|
Total Upload: xx KiB / gzip: xx KiB
|
|
3037
3161
|
Uploaded test-name (TIMINGS)
|
|
3038
3162
|
Published test-name (TIMINGS)
|
|
@@ -3044,6 +3168,352 @@ addEventListener('fetch', event => {});`
|
|
|
3044
3168
|
}
|
|
3045
3169
|
`);
|
|
3046
3170
|
});
|
|
3171
|
+
|
|
3172
|
+
it("should abort other bucket uploads if one bucket upload fails", async () => {
|
|
3173
|
+
// Write 9 20MiB files, should end up with 3 buckets
|
|
3174
|
+
const content = "X".repeat(20 * 1024 * 1024);
|
|
3175
|
+
const assets = Array.from({ length: 9 }, (_, index) => ({
|
|
3176
|
+
filePath: `file-${index}.txt`,
|
|
3177
|
+
content,
|
|
3178
|
+
}));
|
|
3179
|
+
|
|
3180
|
+
const kvNamespace = {
|
|
3181
|
+
title: "__test-name-workers_sites_assets",
|
|
3182
|
+
id: "__test-name-workers_sites_assets-id",
|
|
3183
|
+
};
|
|
3184
|
+
writeWranglerToml({
|
|
3185
|
+
main: "./index.js",
|
|
3186
|
+
site: {
|
|
3187
|
+
bucket: "assets",
|
|
3188
|
+
},
|
|
3189
|
+
});
|
|
3190
|
+
writeWorkerSource();
|
|
3191
|
+
writeAssets(assets);
|
|
3192
|
+
mockUploadWorkerRequest();
|
|
3193
|
+
mockSubDomainRequest();
|
|
3194
|
+
mockListKVNamespacesRequest(kvNamespace);
|
|
3195
|
+
mockKeyListRequest(kvNamespace.id, []);
|
|
3196
|
+
|
|
3197
|
+
let requestCount = 0;
|
|
3198
|
+
const bulkUrl =
|
|
3199
|
+
"*/accounts/:accountId/storage/kv/namespaces/:namespaceId/bulk";
|
|
3200
|
+
msw.use(
|
|
3201
|
+
rest.put(bulkUrl, async (req, res, ctx) => {
|
|
3202
|
+
expect(req.params.accountId).toEqual("some-account-id");
|
|
3203
|
+
expect(req.params.namespaceId).toEqual(kvNamespace.id);
|
|
3204
|
+
requestCount++;
|
|
3205
|
+
return res(
|
|
3206
|
+
ctx.status(500),
|
|
3207
|
+
ctx.json(
|
|
3208
|
+
createFetchResult([], false, [
|
|
3209
|
+
{ code: 1000, message: "Whoops! Something went wrong!" },
|
|
3210
|
+
])
|
|
3211
|
+
)
|
|
3212
|
+
);
|
|
3213
|
+
})
|
|
3214
|
+
);
|
|
3215
|
+
|
|
3216
|
+
await expect(
|
|
3217
|
+
runWrangler("publish")
|
|
3218
|
+
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
3219
|
+
`"A request to the Cloudflare API (/accounts/some-account-id/storage/kv/namespaces/__test-name-workers_sites_assets-id/bulk) failed."`
|
|
3220
|
+
);
|
|
3221
|
+
|
|
3222
|
+
expect(requestCount).toBeLessThan(3);
|
|
3223
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
3224
|
+
"Fetching list of already uploaded assets...
|
|
3225
|
+
Building list of assets to upload...
|
|
3226
|
+
+ file-0.f0d69f705d.txt (uploading new version of file-0.txt)
|
|
3227
|
+
+ file-1.f0d69f705d.txt (uploading new version of file-1.txt)
|
|
3228
|
+
+ file-2.f0d69f705d.txt (uploading new version of file-2.txt)
|
|
3229
|
+
+ file-3.f0d69f705d.txt (uploading new version of file-3.txt)
|
|
3230
|
+
+ file-4.f0d69f705d.txt (uploading new version of file-4.txt)
|
|
3231
|
+
+ file-5.f0d69f705d.txt (uploading new version of file-5.txt)
|
|
3232
|
+
+ file-6.f0d69f705d.txt (uploading new version of file-6.txt)
|
|
3233
|
+
+ file-7.f0d69f705d.txt (uploading new version of file-7.txt)
|
|
3234
|
+
+ file-8.f0d69f705d.txt (uploading new version of file-8.txt)
|
|
3235
|
+
Uploading 9 new assets...
|
|
3236
|
+
Upload failed, aborting..."
|
|
3237
|
+
`);
|
|
3238
|
+
});
|
|
3239
|
+
|
|
3240
|
+
describe("should truncate diff with over 100 assets unless debug log level set", () => {
|
|
3241
|
+
beforeEach(() => {
|
|
3242
|
+
const assets = Array.from({ length: 110 }, (_, index) => ({
|
|
3243
|
+
filePath: `file-${`${index}`.padStart(3, "0")}.txt`,
|
|
3244
|
+
content: "X",
|
|
3245
|
+
}));
|
|
3246
|
+
|
|
3247
|
+
const kvNamespace = {
|
|
3248
|
+
title: "__test-name-workers_sites_assets",
|
|
3249
|
+
id: "__test-name-workers_sites_assets-id",
|
|
3250
|
+
};
|
|
3251
|
+
writeWranglerToml({
|
|
3252
|
+
main: "./index.js",
|
|
3253
|
+
site: {
|
|
3254
|
+
bucket: "assets",
|
|
3255
|
+
},
|
|
3256
|
+
});
|
|
3257
|
+
writeWorkerSource();
|
|
3258
|
+
writeAssets(assets);
|
|
3259
|
+
mockUploadWorkerRequest();
|
|
3260
|
+
mockSubDomainRequest();
|
|
3261
|
+
mockListKVNamespacesRequest(kvNamespace);
|
|
3262
|
+
mockKeyListRequest(kvNamespace.id, []);
|
|
3263
|
+
mockUploadAssetsToKVRequest(kvNamespace.id);
|
|
3264
|
+
});
|
|
3265
|
+
|
|
3266
|
+
it("default log level", async () => {
|
|
3267
|
+
await runWrangler("publish");
|
|
3268
|
+
expect(std).toMatchInlineSnapshot(`
|
|
3269
|
+
Object {
|
|
3270
|
+
"debug": "",
|
|
3271
|
+
"err": "",
|
|
3272
|
+
"info": "Fetching list of already uploaded assets...
|
|
3273
|
+
Building list of assets to upload...
|
|
3274
|
+
+ file-000.010257e8bb.txt (uploading new version of file-000.txt)
|
|
3275
|
+
+ file-001.010257e8bb.txt (uploading new version of file-001.txt)
|
|
3276
|
+
+ file-002.010257e8bb.txt (uploading new version of file-002.txt)
|
|
3277
|
+
+ file-003.010257e8bb.txt (uploading new version of file-003.txt)
|
|
3278
|
+
+ file-004.010257e8bb.txt (uploading new version of file-004.txt)
|
|
3279
|
+
+ file-005.010257e8bb.txt (uploading new version of file-005.txt)
|
|
3280
|
+
+ file-006.010257e8bb.txt (uploading new version of file-006.txt)
|
|
3281
|
+
+ file-007.010257e8bb.txt (uploading new version of file-007.txt)
|
|
3282
|
+
+ file-008.010257e8bb.txt (uploading new version of file-008.txt)
|
|
3283
|
+
+ file-009.010257e8bb.txt (uploading new version of file-009.txt)
|
|
3284
|
+
+ file-010.010257e8bb.txt (uploading new version of file-010.txt)
|
|
3285
|
+
+ file-011.010257e8bb.txt (uploading new version of file-011.txt)
|
|
3286
|
+
+ file-012.010257e8bb.txt (uploading new version of file-012.txt)
|
|
3287
|
+
+ file-013.010257e8bb.txt (uploading new version of file-013.txt)
|
|
3288
|
+
+ file-014.010257e8bb.txt (uploading new version of file-014.txt)
|
|
3289
|
+
+ file-015.010257e8bb.txt (uploading new version of file-015.txt)
|
|
3290
|
+
+ file-016.010257e8bb.txt (uploading new version of file-016.txt)
|
|
3291
|
+
+ file-017.010257e8bb.txt (uploading new version of file-017.txt)
|
|
3292
|
+
+ file-018.010257e8bb.txt (uploading new version of file-018.txt)
|
|
3293
|
+
+ file-019.010257e8bb.txt (uploading new version of file-019.txt)
|
|
3294
|
+
+ file-020.010257e8bb.txt (uploading new version of file-020.txt)
|
|
3295
|
+
+ file-021.010257e8bb.txt (uploading new version of file-021.txt)
|
|
3296
|
+
+ file-022.010257e8bb.txt (uploading new version of file-022.txt)
|
|
3297
|
+
+ file-023.010257e8bb.txt (uploading new version of file-023.txt)
|
|
3298
|
+
+ file-024.010257e8bb.txt (uploading new version of file-024.txt)
|
|
3299
|
+
+ file-025.010257e8bb.txt (uploading new version of file-025.txt)
|
|
3300
|
+
+ file-026.010257e8bb.txt (uploading new version of file-026.txt)
|
|
3301
|
+
+ file-027.010257e8bb.txt (uploading new version of file-027.txt)
|
|
3302
|
+
+ file-028.010257e8bb.txt (uploading new version of file-028.txt)
|
|
3303
|
+
+ file-029.010257e8bb.txt (uploading new version of file-029.txt)
|
|
3304
|
+
+ file-030.010257e8bb.txt (uploading new version of file-030.txt)
|
|
3305
|
+
+ file-031.010257e8bb.txt (uploading new version of file-031.txt)
|
|
3306
|
+
+ file-032.010257e8bb.txt (uploading new version of file-032.txt)
|
|
3307
|
+
+ file-033.010257e8bb.txt (uploading new version of file-033.txt)
|
|
3308
|
+
+ file-034.010257e8bb.txt (uploading new version of file-034.txt)
|
|
3309
|
+
+ file-035.010257e8bb.txt (uploading new version of file-035.txt)
|
|
3310
|
+
+ file-036.010257e8bb.txt (uploading new version of file-036.txt)
|
|
3311
|
+
+ file-037.010257e8bb.txt (uploading new version of file-037.txt)
|
|
3312
|
+
+ file-038.010257e8bb.txt (uploading new version of file-038.txt)
|
|
3313
|
+
+ file-039.010257e8bb.txt (uploading new version of file-039.txt)
|
|
3314
|
+
+ file-040.010257e8bb.txt (uploading new version of file-040.txt)
|
|
3315
|
+
+ file-041.010257e8bb.txt (uploading new version of file-041.txt)
|
|
3316
|
+
+ file-042.010257e8bb.txt (uploading new version of file-042.txt)
|
|
3317
|
+
+ file-043.010257e8bb.txt (uploading new version of file-043.txt)
|
|
3318
|
+
+ file-044.010257e8bb.txt (uploading new version of file-044.txt)
|
|
3319
|
+
+ file-045.010257e8bb.txt (uploading new version of file-045.txt)
|
|
3320
|
+
+ file-046.010257e8bb.txt (uploading new version of file-046.txt)
|
|
3321
|
+
+ file-047.010257e8bb.txt (uploading new version of file-047.txt)
|
|
3322
|
+
+ file-048.010257e8bb.txt (uploading new version of file-048.txt)
|
|
3323
|
+
+ file-049.010257e8bb.txt (uploading new version of file-049.txt)
|
|
3324
|
+
+ file-050.010257e8bb.txt (uploading new version of file-050.txt)
|
|
3325
|
+
+ file-051.010257e8bb.txt (uploading new version of file-051.txt)
|
|
3326
|
+
+ file-052.010257e8bb.txt (uploading new version of file-052.txt)
|
|
3327
|
+
+ file-053.010257e8bb.txt (uploading new version of file-053.txt)
|
|
3328
|
+
+ file-054.010257e8bb.txt (uploading new version of file-054.txt)
|
|
3329
|
+
+ file-055.010257e8bb.txt (uploading new version of file-055.txt)
|
|
3330
|
+
+ file-056.010257e8bb.txt (uploading new version of file-056.txt)
|
|
3331
|
+
+ file-057.010257e8bb.txt (uploading new version of file-057.txt)
|
|
3332
|
+
+ file-058.010257e8bb.txt (uploading new version of file-058.txt)
|
|
3333
|
+
+ file-059.010257e8bb.txt (uploading new version of file-059.txt)
|
|
3334
|
+
+ file-060.010257e8bb.txt (uploading new version of file-060.txt)
|
|
3335
|
+
+ file-061.010257e8bb.txt (uploading new version of file-061.txt)
|
|
3336
|
+
+ file-062.010257e8bb.txt (uploading new version of file-062.txt)
|
|
3337
|
+
+ file-063.010257e8bb.txt (uploading new version of file-063.txt)
|
|
3338
|
+
+ file-064.010257e8bb.txt (uploading new version of file-064.txt)
|
|
3339
|
+
+ file-065.010257e8bb.txt (uploading new version of file-065.txt)
|
|
3340
|
+
+ file-066.010257e8bb.txt (uploading new version of file-066.txt)
|
|
3341
|
+
+ file-067.010257e8bb.txt (uploading new version of file-067.txt)
|
|
3342
|
+
+ file-068.010257e8bb.txt (uploading new version of file-068.txt)
|
|
3343
|
+
+ file-069.010257e8bb.txt (uploading new version of file-069.txt)
|
|
3344
|
+
+ file-070.010257e8bb.txt (uploading new version of file-070.txt)
|
|
3345
|
+
+ file-071.010257e8bb.txt (uploading new version of file-071.txt)
|
|
3346
|
+
+ file-072.010257e8bb.txt (uploading new version of file-072.txt)
|
|
3347
|
+
+ file-073.010257e8bb.txt (uploading new version of file-073.txt)
|
|
3348
|
+
+ file-074.010257e8bb.txt (uploading new version of file-074.txt)
|
|
3349
|
+
+ file-075.010257e8bb.txt (uploading new version of file-075.txt)
|
|
3350
|
+
+ file-076.010257e8bb.txt (uploading new version of file-076.txt)
|
|
3351
|
+
+ file-077.010257e8bb.txt (uploading new version of file-077.txt)
|
|
3352
|
+
+ file-078.010257e8bb.txt (uploading new version of file-078.txt)
|
|
3353
|
+
+ file-079.010257e8bb.txt (uploading new version of file-079.txt)
|
|
3354
|
+
+ file-080.010257e8bb.txt (uploading new version of file-080.txt)
|
|
3355
|
+
+ file-081.010257e8bb.txt (uploading new version of file-081.txt)
|
|
3356
|
+
+ file-082.010257e8bb.txt (uploading new version of file-082.txt)
|
|
3357
|
+
+ file-083.010257e8bb.txt (uploading new version of file-083.txt)
|
|
3358
|
+
+ file-084.010257e8bb.txt (uploading new version of file-084.txt)
|
|
3359
|
+
+ file-085.010257e8bb.txt (uploading new version of file-085.txt)
|
|
3360
|
+
+ file-086.010257e8bb.txt (uploading new version of file-086.txt)
|
|
3361
|
+
+ file-087.010257e8bb.txt (uploading new version of file-087.txt)
|
|
3362
|
+
+ file-088.010257e8bb.txt (uploading new version of file-088.txt)
|
|
3363
|
+
+ file-089.010257e8bb.txt (uploading new version of file-089.txt)
|
|
3364
|
+
+ file-090.010257e8bb.txt (uploading new version of file-090.txt)
|
|
3365
|
+
+ file-091.010257e8bb.txt (uploading new version of file-091.txt)
|
|
3366
|
+
+ file-092.010257e8bb.txt (uploading new version of file-092.txt)
|
|
3367
|
+
+ file-093.010257e8bb.txt (uploading new version of file-093.txt)
|
|
3368
|
+
+ file-094.010257e8bb.txt (uploading new version of file-094.txt)
|
|
3369
|
+
+ file-095.010257e8bb.txt (uploading new version of file-095.txt)
|
|
3370
|
+
+ file-096.010257e8bb.txt (uploading new version of file-096.txt)
|
|
3371
|
+
+ file-097.010257e8bb.txt (uploading new version of file-097.txt)
|
|
3372
|
+
+ file-098.010257e8bb.txt (uploading new version of file-098.txt)
|
|
3373
|
+
+ file-099.010257e8bb.txt (uploading new version of file-099.txt)
|
|
3374
|
+
(truncating changed assets log, set \`WRANGLER_LOG=debug\` environment variable to see full diff)
|
|
3375
|
+
Uploading 110 new assets...
|
|
3376
|
+
Uploaded 100% [110 out of 110]",
|
|
3377
|
+
"out": "↗️ Done syncing assets
|
|
3378
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
3379
|
+
Uploaded test-name (TIMINGS)
|
|
3380
|
+
Published test-name (TIMINGS)
|
|
3381
|
+
https://test-name.test-sub-domain.workers.dev
|
|
3382
|
+
Current Deployment ID: Galaxy-Class",
|
|
3383
|
+
"warn": "",
|
|
3384
|
+
}
|
|
3385
|
+
`);
|
|
3386
|
+
});
|
|
3387
|
+
|
|
3388
|
+
it("debug log level", async () => {
|
|
3389
|
+
logger.loggerLevel = "debug";
|
|
3390
|
+
await runWrangler("publish");
|
|
3391
|
+
|
|
3392
|
+
const diffRegexp = /^ [+=-]/;
|
|
3393
|
+
const diff = std.debug
|
|
3394
|
+
.split("\n")
|
|
3395
|
+
.filter((line) => diffRegexp.test(line))
|
|
3396
|
+
.join("\n");
|
|
3397
|
+
expect(diff).toMatchInlineSnapshot(`
|
|
3398
|
+
" + file-000.010257e8bb.txt (uploading new version of file-000.txt)
|
|
3399
|
+
+ file-001.010257e8bb.txt (uploading new version of file-001.txt)
|
|
3400
|
+
+ file-002.010257e8bb.txt (uploading new version of file-002.txt)
|
|
3401
|
+
+ file-003.010257e8bb.txt (uploading new version of file-003.txt)
|
|
3402
|
+
+ file-004.010257e8bb.txt (uploading new version of file-004.txt)
|
|
3403
|
+
+ file-005.010257e8bb.txt (uploading new version of file-005.txt)
|
|
3404
|
+
+ file-006.010257e8bb.txt (uploading new version of file-006.txt)
|
|
3405
|
+
+ file-007.010257e8bb.txt (uploading new version of file-007.txt)
|
|
3406
|
+
+ file-008.010257e8bb.txt (uploading new version of file-008.txt)
|
|
3407
|
+
+ file-009.010257e8bb.txt (uploading new version of file-009.txt)
|
|
3408
|
+
+ file-010.010257e8bb.txt (uploading new version of file-010.txt)
|
|
3409
|
+
+ file-011.010257e8bb.txt (uploading new version of file-011.txt)
|
|
3410
|
+
+ file-012.010257e8bb.txt (uploading new version of file-012.txt)
|
|
3411
|
+
+ file-013.010257e8bb.txt (uploading new version of file-013.txt)
|
|
3412
|
+
+ file-014.010257e8bb.txt (uploading new version of file-014.txt)
|
|
3413
|
+
+ file-015.010257e8bb.txt (uploading new version of file-015.txt)
|
|
3414
|
+
+ file-016.010257e8bb.txt (uploading new version of file-016.txt)
|
|
3415
|
+
+ file-017.010257e8bb.txt (uploading new version of file-017.txt)
|
|
3416
|
+
+ file-018.010257e8bb.txt (uploading new version of file-018.txt)
|
|
3417
|
+
+ file-019.010257e8bb.txt (uploading new version of file-019.txt)
|
|
3418
|
+
+ file-020.010257e8bb.txt (uploading new version of file-020.txt)
|
|
3419
|
+
+ file-021.010257e8bb.txt (uploading new version of file-021.txt)
|
|
3420
|
+
+ file-022.010257e8bb.txt (uploading new version of file-022.txt)
|
|
3421
|
+
+ file-023.010257e8bb.txt (uploading new version of file-023.txt)
|
|
3422
|
+
+ file-024.010257e8bb.txt (uploading new version of file-024.txt)
|
|
3423
|
+
+ file-025.010257e8bb.txt (uploading new version of file-025.txt)
|
|
3424
|
+
+ file-026.010257e8bb.txt (uploading new version of file-026.txt)
|
|
3425
|
+
+ file-027.010257e8bb.txt (uploading new version of file-027.txt)
|
|
3426
|
+
+ file-028.010257e8bb.txt (uploading new version of file-028.txt)
|
|
3427
|
+
+ file-029.010257e8bb.txt (uploading new version of file-029.txt)
|
|
3428
|
+
+ file-030.010257e8bb.txt (uploading new version of file-030.txt)
|
|
3429
|
+
+ file-031.010257e8bb.txt (uploading new version of file-031.txt)
|
|
3430
|
+
+ file-032.010257e8bb.txt (uploading new version of file-032.txt)
|
|
3431
|
+
+ file-033.010257e8bb.txt (uploading new version of file-033.txt)
|
|
3432
|
+
+ file-034.010257e8bb.txt (uploading new version of file-034.txt)
|
|
3433
|
+
+ file-035.010257e8bb.txt (uploading new version of file-035.txt)
|
|
3434
|
+
+ file-036.010257e8bb.txt (uploading new version of file-036.txt)
|
|
3435
|
+
+ file-037.010257e8bb.txt (uploading new version of file-037.txt)
|
|
3436
|
+
+ file-038.010257e8bb.txt (uploading new version of file-038.txt)
|
|
3437
|
+
+ file-039.010257e8bb.txt (uploading new version of file-039.txt)
|
|
3438
|
+
+ file-040.010257e8bb.txt (uploading new version of file-040.txt)
|
|
3439
|
+
+ file-041.010257e8bb.txt (uploading new version of file-041.txt)
|
|
3440
|
+
+ file-042.010257e8bb.txt (uploading new version of file-042.txt)
|
|
3441
|
+
+ file-043.010257e8bb.txt (uploading new version of file-043.txt)
|
|
3442
|
+
+ file-044.010257e8bb.txt (uploading new version of file-044.txt)
|
|
3443
|
+
+ file-045.010257e8bb.txt (uploading new version of file-045.txt)
|
|
3444
|
+
+ file-046.010257e8bb.txt (uploading new version of file-046.txt)
|
|
3445
|
+
+ file-047.010257e8bb.txt (uploading new version of file-047.txt)
|
|
3446
|
+
+ file-048.010257e8bb.txt (uploading new version of file-048.txt)
|
|
3447
|
+
+ file-049.010257e8bb.txt (uploading new version of file-049.txt)
|
|
3448
|
+
+ file-050.010257e8bb.txt (uploading new version of file-050.txt)
|
|
3449
|
+
+ file-051.010257e8bb.txt (uploading new version of file-051.txt)
|
|
3450
|
+
+ file-052.010257e8bb.txt (uploading new version of file-052.txt)
|
|
3451
|
+
+ file-053.010257e8bb.txt (uploading new version of file-053.txt)
|
|
3452
|
+
+ file-054.010257e8bb.txt (uploading new version of file-054.txt)
|
|
3453
|
+
+ file-055.010257e8bb.txt (uploading new version of file-055.txt)
|
|
3454
|
+
+ file-056.010257e8bb.txt (uploading new version of file-056.txt)
|
|
3455
|
+
+ file-057.010257e8bb.txt (uploading new version of file-057.txt)
|
|
3456
|
+
+ file-058.010257e8bb.txt (uploading new version of file-058.txt)
|
|
3457
|
+
+ file-059.010257e8bb.txt (uploading new version of file-059.txt)
|
|
3458
|
+
+ file-060.010257e8bb.txt (uploading new version of file-060.txt)
|
|
3459
|
+
+ file-061.010257e8bb.txt (uploading new version of file-061.txt)
|
|
3460
|
+
+ file-062.010257e8bb.txt (uploading new version of file-062.txt)
|
|
3461
|
+
+ file-063.010257e8bb.txt (uploading new version of file-063.txt)
|
|
3462
|
+
+ file-064.010257e8bb.txt (uploading new version of file-064.txt)
|
|
3463
|
+
+ file-065.010257e8bb.txt (uploading new version of file-065.txt)
|
|
3464
|
+
+ file-066.010257e8bb.txt (uploading new version of file-066.txt)
|
|
3465
|
+
+ file-067.010257e8bb.txt (uploading new version of file-067.txt)
|
|
3466
|
+
+ file-068.010257e8bb.txt (uploading new version of file-068.txt)
|
|
3467
|
+
+ file-069.010257e8bb.txt (uploading new version of file-069.txt)
|
|
3468
|
+
+ file-070.010257e8bb.txt (uploading new version of file-070.txt)
|
|
3469
|
+
+ file-071.010257e8bb.txt (uploading new version of file-071.txt)
|
|
3470
|
+
+ file-072.010257e8bb.txt (uploading new version of file-072.txt)
|
|
3471
|
+
+ file-073.010257e8bb.txt (uploading new version of file-073.txt)
|
|
3472
|
+
+ file-074.010257e8bb.txt (uploading new version of file-074.txt)
|
|
3473
|
+
+ file-075.010257e8bb.txt (uploading new version of file-075.txt)
|
|
3474
|
+
+ file-076.010257e8bb.txt (uploading new version of file-076.txt)
|
|
3475
|
+
+ file-077.010257e8bb.txt (uploading new version of file-077.txt)
|
|
3476
|
+
+ file-078.010257e8bb.txt (uploading new version of file-078.txt)
|
|
3477
|
+
+ file-079.010257e8bb.txt (uploading new version of file-079.txt)
|
|
3478
|
+
+ file-080.010257e8bb.txt (uploading new version of file-080.txt)
|
|
3479
|
+
+ file-081.010257e8bb.txt (uploading new version of file-081.txt)
|
|
3480
|
+
+ file-082.010257e8bb.txt (uploading new version of file-082.txt)
|
|
3481
|
+
+ file-083.010257e8bb.txt (uploading new version of file-083.txt)
|
|
3482
|
+
+ file-084.010257e8bb.txt (uploading new version of file-084.txt)
|
|
3483
|
+
+ file-085.010257e8bb.txt (uploading new version of file-085.txt)
|
|
3484
|
+
+ file-086.010257e8bb.txt (uploading new version of file-086.txt)
|
|
3485
|
+
+ file-087.010257e8bb.txt (uploading new version of file-087.txt)
|
|
3486
|
+
+ file-088.010257e8bb.txt (uploading new version of file-088.txt)
|
|
3487
|
+
+ file-089.010257e8bb.txt (uploading new version of file-089.txt)
|
|
3488
|
+
+ file-090.010257e8bb.txt (uploading new version of file-090.txt)
|
|
3489
|
+
+ file-091.010257e8bb.txt (uploading new version of file-091.txt)
|
|
3490
|
+
+ file-092.010257e8bb.txt (uploading new version of file-092.txt)
|
|
3491
|
+
+ file-093.010257e8bb.txt (uploading new version of file-093.txt)
|
|
3492
|
+
+ file-094.010257e8bb.txt (uploading new version of file-094.txt)
|
|
3493
|
+
+ file-095.010257e8bb.txt (uploading new version of file-095.txt)
|
|
3494
|
+
+ file-096.010257e8bb.txt (uploading new version of file-096.txt)
|
|
3495
|
+
+ file-097.010257e8bb.txt (uploading new version of file-097.txt)
|
|
3496
|
+
+ file-098.010257e8bb.txt (uploading new version of file-098.txt)
|
|
3497
|
+
+ file-099.010257e8bb.txt (uploading new version of file-099.txt)
|
|
3498
|
+
+ file-100.010257e8bb.txt (uploading new version of file-100.txt)
|
|
3499
|
+
+ file-101.010257e8bb.txt (uploading new version of file-101.txt)
|
|
3500
|
+
+ file-102.010257e8bb.txt (uploading new version of file-102.txt)
|
|
3501
|
+
+ file-103.010257e8bb.txt (uploading new version of file-103.txt)
|
|
3502
|
+
+ file-104.010257e8bb.txt (uploading new version of file-104.txt)
|
|
3503
|
+
+ file-105.010257e8bb.txt (uploading new version of file-105.txt)
|
|
3504
|
+
+ file-106.010257e8bb.txt (uploading new version of file-106.txt)
|
|
3505
|
+
+ file-107.010257e8bb.txt (uploading new version of file-107.txt)
|
|
3506
|
+
+ file-108.010257e8bb.txt (uploading new version of file-108.txt)
|
|
3507
|
+
+ file-109.010257e8bb.txt (uploading new version of file-109.txt)"
|
|
3508
|
+
`);
|
|
3509
|
+
expect(std.info).toMatchInlineSnapshot(`
|
|
3510
|
+
"Fetching list of already uploaded assets...
|
|
3511
|
+
Building list of assets to upload...
|
|
3512
|
+
Uploading 110 new assets...
|
|
3513
|
+
Uploaded 100% [110 out of 110]"
|
|
3514
|
+
`);
|
|
3515
|
+
});
|
|
3516
|
+
});
|
|
3047
3517
|
});
|
|
3048
3518
|
|
|
3049
3519
|
describe("workers_dev setting", () => {
|
|
@@ -3840,7 +4310,7 @@ addEventListener('fetch', event => {});`
|
|
|
3840
4310
|
it("should run a custom build before publishing", async () => {
|
|
3841
4311
|
writeWranglerToml({
|
|
3842
4312
|
build: {
|
|
3843
|
-
command: `node -e "
|
|
4313
|
+
command: `node -e "4+4; require('fs').writeFileSync('index.js', 'export default { fetch(){ return new Response(123) } }')"`,
|
|
3844
4314
|
},
|
|
3845
4315
|
});
|
|
3846
4316
|
|
|
@@ -3851,7 +4321,7 @@ addEventListener('fetch', event => {});`
|
|
|
3851
4321
|
|
|
3852
4322
|
await runWrangler("publish index.js");
|
|
3853
4323
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3854
|
-
"Running custom build: node -e \\"
|
|
4324
|
+
"Running custom build: node -e \\"4+4; require('fs').writeFileSync('index.js', 'export default { fetch(){ return new Response(123) } }')\\"
|
|
3855
4325
|
Total Upload: xx KiB / gzip: xx KiB
|
|
3856
4326
|
Uploaded test-name (TIMINGS)
|
|
3857
4327
|
Published test-name (TIMINGS)
|
|
@@ -3866,7 +4336,7 @@ addEventListener('fetch', event => {});`
|
|
|
3866
4336
|
it("should run a custom build of multiple steps combined by && before publishing", async () => {
|
|
3867
4337
|
writeWranglerToml({
|
|
3868
4338
|
build: {
|
|
3869
|
-
command: `echo "
|
|
4339
|
+
command: `echo "export default { fetch(){ return new Response(123) } }" > index.js`,
|
|
3870
4340
|
},
|
|
3871
4341
|
});
|
|
3872
4342
|
|
|
@@ -3877,7 +4347,7 @@ addEventListener('fetch', event => {});`
|
|
|
3877
4347
|
|
|
3878
4348
|
await runWrangler("publish index.js");
|
|
3879
4349
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3880
|
-
"Running custom build: echo \\"
|
|
4350
|
+
"Running custom build: echo \\"export default { fetch(){ return new Response(123) } }\\" > index.js
|
|
3881
4351
|
Total Upload: xx KiB / gzip: xx KiB
|
|
3882
4352
|
Uploaded test-name (TIMINGS)
|
|
3883
4353
|
Published test-name (TIMINGS)
|
|
@@ -3893,22 +4363,22 @@ addEventListener('fetch', event => {});`
|
|
|
3893
4363
|
writeWranglerToml({
|
|
3894
4364
|
main: "index.js",
|
|
3895
4365
|
build: {
|
|
3896
|
-
command: `node -e "
|
|
4366
|
+
command: `node -e "4+4;"`,
|
|
3897
4367
|
},
|
|
3898
4368
|
});
|
|
3899
4369
|
|
|
3900
4370
|
await expect(runWrangler("publish index.js")).rejects
|
|
3901
4371
|
.toThrowErrorMatchingInlineSnapshot(`
|
|
3902
|
-
"The expected output file at \\"index.js\\" was not found after running custom build: node -e \\"
|
|
4372
|
+
"The expected output file at \\"index.js\\" was not found after running custom build: node -e \\"4+4;\\".
|
|
3903
4373
|
The \`main\` property in wrangler.toml should point to the file generated by the custom build."
|
|
3904
4374
|
`);
|
|
3905
4375
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3906
|
-
"Running custom build: node -e \\"
|
|
4376
|
+
"Running custom build: node -e \\"4+4;\\"
|
|
3907
4377
|
|
|
3908
4378
|
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
3909
4379
|
`);
|
|
3910
4380
|
expect(std.err).toMatchInlineSnapshot(`
|
|
3911
|
-
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mThe expected output file at \\"index.js\\" was not found after running custom build: node -e \\"
|
|
4381
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mThe expected output file at \\"index.js\\" was not found after running custom build: node -e \\"4+4;\\".[0m
|
|
3912
4382
|
|
|
3913
4383
|
The \`main\` property in wrangler.toml should point to the file generated by the custom build.
|
|
3914
4384
|
|
|
@@ -3921,7 +4391,7 @@ addEventListener('fetch', event => {});`
|
|
|
3921
4391
|
writeWranglerToml({
|
|
3922
4392
|
main: "./",
|
|
3923
4393
|
build: {
|
|
3924
|
-
command: `node -e "
|
|
4394
|
+
command: `node -e "4+4;"`,
|
|
3925
4395
|
},
|
|
3926
4396
|
});
|
|
3927
4397
|
|
|
@@ -3931,7 +4401,7 @@ addEventListener('fetch', event => {});`
|
|
|
3931
4401
|
|
|
3932
4402
|
await expect(runWrangler("publish")).rejects
|
|
3933
4403
|
.toThrowErrorMatchingInlineSnapshot(`
|
|
3934
|
-
"The expected output file at \\".\\" was not found after running custom build: node -e \\"
|
|
4404
|
+
"The expected output file at \\".\\" was not found after running custom build: node -e \\"4+4;\\".
|
|
3935
4405
|
The \`main\` property in wrangler.toml should point to the file generated by the custom build.
|
|
3936
4406
|
The provided entry-point path, \\".\\", points to a directory, rather than a file.
|
|
3937
4407
|
|
|
@@ -3942,12 +4412,12 @@ addEventListener('fetch', event => {});`
|
|
|
3942
4412
|
\`\`\`"
|
|
3943
4413
|
`);
|
|
3944
4414
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3945
|
-
"Running custom build: node -e \\"
|
|
4415
|
+
"Running custom build: node -e \\"4+4;\\"
|
|
3946
4416
|
|
|
3947
4417
|
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
3948
4418
|
`);
|
|
3949
4419
|
expect(std.err).toMatchInlineSnapshot(`
|
|
3950
|
-
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mThe expected output file at \\".\\" was not found after running custom build: node -e \\"
|
|
4420
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mThe expected output file at \\".\\" was not found after running custom build: node -e \\"4+4;\\".[0m
|
|
3951
4421
|
|
|
3952
4422
|
The \`main\` property in wrangler.toml should point to the file generated by the custom build.
|
|
3953
4423
|
The provided entry-point path, \\".\\", points to a directory, rather than a file.
|
|
@@ -4197,6 +4667,7 @@ addEventListener('fetch', event => {});`
|
|
|
4197
4667
|
Object {
|
|
4198
4668
|
"debug": "",
|
|
4199
4669
|
"err": "",
|
|
4670
|
+
"info": "",
|
|
4200
4671
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4201
4672
|
Your worker has access to the following bindings:
|
|
4202
4673
|
- Durable Objects:
|
|
@@ -4242,6 +4713,7 @@ addEventListener('fetch', event => {});`
|
|
|
4242
4713
|
Object {
|
|
4243
4714
|
"debug": "",
|
|
4244
4715
|
"err": "",
|
|
4716
|
+
"info": "",
|
|
4245
4717
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4246
4718
|
Your worker has access to the following bindings:
|
|
4247
4719
|
- Durable Objects:
|
|
@@ -4415,6 +4887,7 @@ addEventListener('fetch', event => {});`
|
|
|
4415
4887
|
Object {
|
|
4416
4888
|
"debug": "",
|
|
4417
4889
|
"err": "",
|
|
4890
|
+
"info": "",
|
|
4418
4891
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4419
4892
|
Your worker has access to the following bindings:
|
|
4420
4893
|
- Durable Objects:
|
|
@@ -4485,6 +4958,7 @@ addEventListener('fetch', event => {});`
|
|
|
4485
4958
|
Object {
|
|
4486
4959
|
"debug": "",
|
|
4487
4960
|
"err": "",
|
|
4961
|
+
"info": "",
|
|
4488
4962
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4489
4963
|
Your worker has access to the following bindings:
|
|
4490
4964
|
- Durable Objects:
|
|
@@ -4559,6 +5033,10 @@ addEventListener('fetch', event => {});`
|
|
|
4559
5033
|
data: 1337,
|
|
4560
5034
|
},
|
|
4561
5035
|
],
|
|
5036
|
+
metadata: {
|
|
5037
|
+
extra_data: "interesting value",
|
|
5038
|
+
more_data: "dubious value",
|
|
5039
|
+
},
|
|
4562
5040
|
},
|
|
4563
5041
|
vars: {
|
|
4564
5042
|
ENV_VAR_ONE: 123,
|
|
@@ -4603,6 +5081,10 @@ addEventListener('fetch', event => {});`
|
|
|
4603
5081
|
|
|
4604
5082
|
mockUploadWorkerRequest({
|
|
4605
5083
|
expectedType: "sw",
|
|
5084
|
+
expectedUnsafeMetaData: {
|
|
5085
|
+
extra_data: "interesting value",
|
|
5086
|
+
more_data: "dubious value",
|
|
5087
|
+
},
|
|
4606
5088
|
expectedBindings: [
|
|
4607
5089
|
{ json: 123, name: "ENV_VAR_ONE", type: "json" },
|
|
4608
5090
|
{
|
|
@@ -4726,6 +5208,9 @@ addEventListener('fetch', event => {});`
|
|
|
4726
5208
|
- Wasm Modules:
|
|
4727
5209
|
- WASM_MODULE_ONE: some_wasm.wasm
|
|
4728
5210
|
- WASM_MODULE_TWO: more_wasm.wasm
|
|
5211
|
+
- Unsafe Metadata:
|
|
5212
|
+
- extra_data: interesting value
|
|
5213
|
+
- more_data: dubious value
|
|
4729
5214
|
Uploaded test-name (TIMINGS)
|
|
4730
5215
|
Published test-name (TIMINGS)
|
|
4731
5216
|
https://test-name.test-sub-domain.workers.dev
|
|
@@ -4794,6 +5279,7 @@ addEventListener('fetch', event => {});`
|
|
|
4794
5279
|
data: 1337,
|
|
4795
5280
|
},
|
|
4796
5281
|
],
|
|
5282
|
+
metadata: undefined,
|
|
4797
5283
|
},
|
|
4798
5284
|
vars: {
|
|
4799
5285
|
ENV_VAR_ONE: 123,
|
|
@@ -4907,6 +5393,7 @@ addEventListener('fetch', event => {});`
|
|
|
4907
5393
|
data: 1337,
|
|
4908
5394
|
},
|
|
4909
5395
|
],
|
|
5396
|
+
metadata: undefined,
|
|
4910
5397
|
},
|
|
4911
5398
|
// text_blobs, vars, wasm_modules and data_blobs are fine because they're object literals,
|
|
4912
5399
|
// and by definition cannot have two keys of the same name
|
|
@@ -5055,6 +5542,7 @@ addEventListener('fetch', event => {});`
|
|
|
5055
5542
|
data: null,
|
|
5056
5543
|
},
|
|
5057
5544
|
],
|
|
5545
|
+
metadata: undefined,
|
|
5058
5546
|
},
|
|
5059
5547
|
vars: {
|
|
5060
5548
|
ENV_VAR_ONE: 123,
|
|
@@ -5541,6 +6029,7 @@ addEventListener('fetch', event => {});`
|
|
|
5541
6029
|
Object {
|
|
5542
6030
|
"debug": "",
|
|
5543
6031
|
"err": "",
|
|
6032
|
+
"info": "",
|
|
5544
6033
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
5545
6034
|
Your worker has access to the following bindings:
|
|
5546
6035
|
- Vars:
|
|
@@ -5832,7 +6321,7 @@ addEventListener('fetch', event => {});`
|
|
|
5832
6321
|
|
|
5833
6322
|
"
|
|
5834
6323
|
`);
|
|
5835
|
-
const output = fs.readFileSync("tmp/
|
|
6324
|
+
const output = fs.readFileSync("tmp/index.js", "utf-8");
|
|
5836
6325
|
expect(output).toContain(
|
|
5837
6326
|
`var ExampleDurableObject2 = maskDurableObjectDefinition(ExampleDurableObject);`
|
|
5838
6327
|
);
|
|
@@ -5992,6 +6481,7 @@ addEventListener('fetch', event => {});`
|
|
|
5992
6481
|
param: "binding-param",
|
|
5993
6482
|
},
|
|
5994
6483
|
],
|
|
6484
|
+
metadata: undefined,
|
|
5995
6485
|
},
|
|
5996
6486
|
});
|
|
5997
6487
|
writeWorkerSource();
|
|
@@ -6036,6 +6526,7 @@ addEventListener('fetch', event => {});`
|
|
|
6036
6526
|
text: "text",
|
|
6037
6527
|
},
|
|
6038
6528
|
],
|
|
6529
|
+
metadata: undefined,
|
|
6039
6530
|
},
|
|
6040
6531
|
});
|
|
6041
6532
|
writeWorkerSource();
|
|
@@ -6479,6 +6970,7 @@ addEventListener('fetch', event => {});`
|
|
|
6479
6970
|
Object {
|
|
6480
6971
|
"debug": "",
|
|
6481
6972
|
"err": "",
|
|
6973
|
+
"info": "",
|
|
6482
6974
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6483
6975
|
Uploaded test-name (TIMINGS)
|
|
6484
6976
|
Published test-name (TIMINGS)
|
|
@@ -6489,9 +6981,22 @@ addEventListener('fetch', event => {});`
|
|
|
6489
6981
|
`);
|
|
6490
6982
|
});
|
|
6491
6983
|
|
|
6492
|
-
it("should output to target
|
|
6984
|
+
it("should output to target es2022 even if tsconfig says otherwise", async () => {
|
|
6493
6985
|
writeWranglerToml();
|
|
6494
6986
|
writeWorkerSource();
|
|
6987
|
+
fs.writeFileSync(
|
|
6988
|
+
"./index.js",
|
|
6989
|
+
`
|
|
6990
|
+
import { foo } from "./another";
|
|
6991
|
+
const topLevelAwait = await new Promise((resolve) => setTimeout(resolve, 0));
|
|
6992
|
+
|
|
6993
|
+
export default {
|
|
6994
|
+
async fetch(request) {
|
|
6995
|
+
|
|
6996
|
+
return new Response("Hello world!");
|
|
6997
|
+
},
|
|
6998
|
+
};`
|
|
6999
|
+
);
|
|
6495
7000
|
fs.writeFileSync(
|
|
6496
7001
|
"tsconfig.json",
|
|
6497
7002
|
JSON.stringify({
|
|
@@ -6502,14 +7007,21 @@ addEventListener('fetch', event => {});`
|
|
|
6502
7007
|
})
|
|
6503
7008
|
);
|
|
6504
7009
|
mockSubDomainRequest();
|
|
7010
|
+
/**
|
|
7011
|
+
* When we compile with es2022, we should preserve the export statement and top level await
|
|
7012
|
+
* If you attempt to target es2020 top level await will cause a build error
|
|
7013
|
+
* @error Build failed with 1 error:
|
|
7014
|
+
* index.js:3:25: ERROR: Top-level await is not available in the configured target environment ("es2020")
|
|
7015
|
+
*/
|
|
6505
7016
|
mockUploadWorkerRequest({
|
|
6506
|
-
expectedEntry: "export {", //
|
|
7017
|
+
expectedEntry: "export {", // check that the export is preserved
|
|
6507
7018
|
});
|
|
6508
7019
|
await runWrangler("publish index.js"); // this would throw if we tried to compile with es5
|
|
6509
7020
|
expect(std).toMatchInlineSnapshot(`
|
|
6510
7021
|
Object {
|
|
6511
7022
|
"debug": "",
|
|
6512
7023
|
"err": "",
|
|
7024
|
+
"info": "",
|
|
6513
7025
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6514
7026
|
Uploaded test-name (TIMINGS)
|
|
6515
7027
|
Published test-name (TIMINGS)
|
|
@@ -6534,6 +7046,7 @@ addEventListener('fetch', event => {});`
|
|
|
6534
7046
|
Object {
|
|
6535
7047
|
"debug": "",
|
|
6536
7048
|
"err": "",
|
|
7049
|
+
"info": "",
|
|
6537
7050
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6538
7051
|
Uploaded test-name (TIMINGS)
|
|
6539
7052
|
Published test-name (TIMINGS)
|
|
@@ -6544,6 +7057,49 @@ addEventListener('fetch', event => {});`
|
|
|
6544
7057
|
`);
|
|
6545
7058
|
});
|
|
6546
7059
|
|
|
7060
|
+
it("should preserve the entry point file name, even when using a facade", async () => {
|
|
7061
|
+
writeWranglerToml();
|
|
7062
|
+
writeWorkerSource();
|
|
7063
|
+
mockSubDomainRequest();
|
|
7064
|
+
mockUploadWorkerRequest();
|
|
7065
|
+
const assets = [
|
|
7066
|
+
{ filePath: "file-1.txt", content: "Content of file-1" },
|
|
7067
|
+
{ filePath: "file-2.txt", content: "Content of file-2" },
|
|
7068
|
+
];
|
|
7069
|
+
const kvNamespace = {
|
|
7070
|
+
title: "__test-name-workers_sites_assets",
|
|
7071
|
+
id: "__test-name-workers_sites_assets-id",
|
|
7072
|
+
};
|
|
7073
|
+
writeAssets(assets);
|
|
7074
|
+
mockListKVNamespacesRequest(kvNamespace);
|
|
7075
|
+
mockKeyListRequest(kvNamespace.id, []);
|
|
7076
|
+
mockUploadAssetsToKVRequest(kvNamespace.id, assets);
|
|
7077
|
+
await runWrangler("publish index.js --outdir some-dir --assets assets");
|
|
7078
|
+
expect(fs.existsSync("some-dir/index.js")).toBe(true);
|
|
7079
|
+
expect(fs.existsSync("some-dir/index.js.map")).toBe(true);
|
|
7080
|
+
expect(std).toMatchInlineSnapshot(`
|
|
7081
|
+
Object {
|
|
7082
|
+
"debug": "",
|
|
7083
|
+
"err": "",
|
|
7084
|
+
"info": "Fetching list of already uploaded assets...
|
|
7085
|
+
Building list of assets to upload...
|
|
7086
|
+
+ file-1.2ca234f380.txt (uploading new version of file-1.txt)
|
|
7087
|
+
+ file-2.5938485188.txt (uploading new version of file-2.txt)
|
|
7088
|
+
Uploading 2 new assets...
|
|
7089
|
+
Uploaded 100% [2 out of 2]",
|
|
7090
|
+
"out": "↗️ Done syncing assets
|
|
7091
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
7092
|
+
Uploaded test-name (TIMINGS)
|
|
7093
|
+
Published test-name (TIMINGS)
|
|
7094
|
+
https://test-name.test-sub-domain.workers.dev
|
|
7095
|
+
Current Deployment ID: Galaxy-Class",
|
|
7096
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mThe --assets argument is experimental and may change or break at any time[0m
|
|
7097
|
+
|
|
7098
|
+
",
|
|
7099
|
+
}
|
|
7100
|
+
`);
|
|
7101
|
+
});
|
|
7102
|
+
|
|
6547
7103
|
it("should copy any module imports related assets to --outdir if specified", async () => {
|
|
6548
7104
|
writeWranglerToml();
|
|
6549
7105
|
fs.writeFileSync(
|
|
@@ -6589,6 +7145,7 @@ export default{
|
|
|
6589
7145
|
Object {
|
|
6590
7146
|
"debug": "",
|
|
6591
7147
|
"err": "",
|
|
7148
|
+
"info": "",
|
|
6592
7149
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6593
7150
|
Uploaded test-name (TIMINGS)
|
|
6594
7151
|
Published test-name (TIMINGS)
|
|
@@ -6617,6 +7174,7 @@ export default{
|
|
|
6617
7174
|
Object {
|
|
6618
7175
|
"debug": "",
|
|
6619
7176
|
"err": "",
|
|
7177
|
+
"info": "",
|
|
6620
7178
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6621
7179
|
Your worker has access to the following bindings:
|
|
6622
7180
|
- Durable Objects:
|
|
@@ -6634,16 +7192,17 @@ export default{
|
|
|
6634
7192
|
writeWorkerSource();
|
|
6635
7193
|
await runWrangler("publish index.js --node-compat --dry-run");
|
|
6636
7194
|
expect(std).toMatchInlineSnapshot(`
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
7195
|
+
Object {
|
|
7196
|
+
"debug": "",
|
|
7197
|
+
"err": "",
|
|
7198
|
+
"info": "",
|
|
7199
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7200
|
+
--dry-run: exiting now.",
|
|
7201
|
+
"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
|
|
7202
|
+
|
|
7203
|
+
",
|
|
7204
|
+
}
|
|
7205
|
+
`);
|
|
6647
7206
|
});
|
|
6648
7207
|
|
|
6649
7208
|
it("should recommend node compatibility mode when using node builtins and node-compat isn't enabled", async () => {
|
|
@@ -6681,16 +7240,90 @@ export default{
|
|
|
6681
7240
|
);
|
|
6682
7241
|
await runWrangler("publish index.js --node-compat --dry-run"); // this would throw if node compatibility didn't exist
|
|
6683
7242
|
expect(std).toMatchInlineSnapshot(`
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
7243
|
+
Object {
|
|
7244
|
+
"debug": "",
|
|
7245
|
+
"err": "",
|
|
7246
|
+
"info": "",
|
|
7247
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7248
|
+
--dry-run: exiting now.",
|
|
7249
|
+
"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
|
|
7250
|
+
|
|
7251
|
+
",
|
|
7252
|
+
}
|
|
7253
|
+
`);
|
|
7254
|
+
});
|
|
7255
|
+
});
|
|
7256
|
+
|
|
7257
|
+
describe("`nodejs_compat` compatibility flag", () => {
|
|
7258
|
+
it('when absent, should error on any "external" `node:*` imports', async () => {
|
|
7259
|
+
writeWranglerToml();
|
|
7260
|
+
fs.writeFileSync(
|
|
7261
|
+
"index.js",
|
|
7262
|
+
`
|
|
7263
|
+
import AsyncHooks from 'node:async_hooks';
|
|
7264
|
+
console.log(AsyncHooks);
|
|
7265
|
+
export default {}
|
|
7266
|
+
`
|
|
7267
|
+
);
|
|
7268
|
+
let err: esbuild.BuildFailure | undefined;
|
|
7269
|
+
try {
|
|
7270
|
+
await runWrangler("publish index.js --dry-run"); // expecting this to throw, as node compatibility isn't enabled
|
|
7271
|
+
} catch (e) {
|
|
7272
|
+
err = e as esbuild.BuildFailure;
|
|
7273
|
+
}
|
|
7274
|
+
expect(
|
|
7275
|
+
esbuild.formatMessagesSync(err?.errors ?? [], { kind: "error" }).join()
|
|
7276
|
+
).toMatch(/Could not resolve "node:async_hooks"/);
|
|
7277
|
+
});
|
|
7278
|
+
|
|
7279
|
+
it('when present, should support any "external" `node:*` imports', async () => {
|
|
7280
|
+
writeWranglerToml();
|
|
7281
|
+
fs.writeFileSync(
|
|
7282
|
+
"index.js",
|
|
7283
|
+
`
|
|
7284
|
+
import AsyncHooks from 'node:async_hooks';
|
|
7285
|
+
console.log(AsyncHooks);
|
|
7286
|
+
export default {}
|
|
7287
|
+
`
|
|
7288
|
+
);
|
|
7289
|
+
|
|
7290
|
+
await runWrangler(
|
|
7291
|
+
"publish index.js --dry-run --outdir=dist --compatibility-flag=nodejs_compat"
|
|
7292
|
+
);
|
|
7293
|
+
|
|
7294
|
+
expect(std).toMatchInlineSnapshot(`
|
|
7295
|
+
Object {
|
|
7296
|
+
"debug": "",
|
|
7297
|
+
"err": "",
|
|
7298
|
+
"info": "",
|
|
7299
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7300
|
+
--dry-run: exiting now.",
|
|
7301
|
+
"warn": "",
|
|
7302
|
+
}
|
|
7303
|
+
`);
|
|
7304
|
+
expect(fs.readFileSync("dist/index.js", { encoding: "utf-8" })).toContain(
|
|
7305
|
+
`import AsyncHooks from "node:async_hooks";`
|
|
7306
|
+
);
|
|
7307
|
+
});
|
|
7308
|
+
|
|
7309
|
+
it("should conflict with the --node-compat option", async () => {
|
|
7310
|
+
writeWranglerToml();
|
|
7311
|
+
fs.writeFileSync(
|
|
7312
|
+
"index.js",
|
|
7313
|
+
`
|
|
7314
|
+
import AsyncHooks from 'node:async_hooks';
|
|
7315
|
+
console.log(AsyncHooks);
|
|
7316
|
+
export default {}
|
|
7317
|
+
`
|
|
7318
|
+
);
|
|
7319
|
+
|
|
7320
|
+
await expect(
|
|
7321
|
+
runWrangler(
|
|
7322
|
+
"publish index.js --dry-run --outdir=dist --compatibility-flag=nodejs_compat --node-compat"
|
|
7323
|
+
)
|
|
7324
|
+
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
7325
|
+
`"The \`nodejs_compat\` compatibility flag cannot be used in conjunction with the legacy \`--node-compat\` flag. If you want to use the Workers runtime Node.js compatibility features, please remove the \`--node-compat\` argument from your CLI command or \`node_compat = true\` from your config file."`
|
|
7326
|
+
);
|
|
6694
7327
|
});
|
|
6695
7328
|
});
|
|
6696
7329
|
|
|
@@ -6735,6 +7368,7 @@ export default{
|
|
|
6735
7368
|
Object {
|
|
6736
7369
|
"debug": "",
|
|
6737
7370
|
"err": "",
|
|
7371
|
+
"info": "",
|
|
6738
7372
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6739
7373
|
Uploaded test-name (TIMINGS)
|
|
6740
7374
|
Published test-name (TIMINGS)
|
|
@@ -6797,23 +7431,24 @@ export default{
|
|
|
6797
7431
|
`[ParseError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
|
|
6798
7432
|
);
|
|
6799
7433
|
expect(std).toMatchInlineSnapshot(`
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
7434
|
+
Object {
|
|
7435
|
+
"debug": "",
|
|
7436
|
+
"err": "",
|
|
7437
|
+
"info": "",
|
|
7438
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6804
7439
|
|
|
6805
|
-
|
|
7440
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.[0m
|
|
6806
7441
|
|
|
6807
|
-
|
|
6808
|
-
|
|
7442
|
+
Script startup timed out. This could be due to script exceeding size limits or expensive code in
|
|
7443
|
+
the global scope. [code: 11337]
|
|
6809
7444
|
|
|
6810
|
-
|
|
6811
|
-
|
|
7445
|
+
If you think this is a bug, please open an issue at:
|
|
7446
|
+
[4mhttps://github.com/cloudflare/workers-sdk/issues/new/choose[0m
|
|
6812
7447
|
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
7448
|
+
",
|
|
7449
|
+
"warn": "",
|
|
7450
|
+
}
|
|
7451
|
+
`);
|
|
6817
7452
|
});
|
|
6818
7453
|
|
|
6819
7454
|
test("should check biggest dependencies when upload fails with script size error", async () => {
|
|
@@ -6863,6 +7498,7 @@ export default{
|
|
|
6863
7498
|
Object {
|
|
6864
7499
|
"debug": "",
|
|
6865
7500
|
"err": "",
|
|
7501
|
+
"info": "",
|
|
6866
7502
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6867
7503
|
|
|
6868
7504
|
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.[0m
|
|
@@ -6929,6 +7565,7 @@ export default{
|
|
|
6929
7565
|
Object {
|
|
6930
7566
|
"debug": "",
|
|
6931
7567
|
"err": "",
|
|
7568
|
+
"info": "",
|
|
6932
7569
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6933
7570
|
|
|
6934
7571
|
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.[0m
|
|
@@ -6967,6 +7604,7 @@ export default{
|
|
|
6967
7604
|
Object {
|
|
6968
7605
|
"debug": "",
|
|
6969
7606
|
"err": "",
|
|
7607
|
+
"info": "",
|
|
6970
7608
|
"out": "Total Upload: xx KiB / gzip: xx KiB",
|
|
6971
7609
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mWe recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding past this can affect cold start time[0m
|
|
6972
7610
|
|
|
@@ -6989,6 +7627,7 @@ export default{
|
|
|
6989
7627
|
Object {
|
|
6990
7628
|
"debug": "",
|
|
6991
7629
|
"err": "",
|
|
7630
|
+
"info": "",
|
|
6992
7631
|
"out": "Total Upload: xx KiB / gzip: xx KiB",
|
|
6993
7632
|
"warn": "",
|
|
6994
7633
|
}
|
|
@@ -7017,6 +7656,7 @@ export default{
|
|
|
7017
7656
|
Object {
|
|
7018
7657
|
"debug": "",
|
|
7019
7658
|
"err": "",
|
|
7659
|
+
"info": "",
|
|
7020
7660
|
"out": "",
|
|
7021
7661
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mHere are the 5 largest dependencies included in your script:[0m
|
|
7022
7662
|
|
|
@@ -7106,7 +7746,7 @@ export default{
|
|
|
7106
7746
|
"publish index.js --no-bundle --node-compat --dry-run --outdir dist"
|
|
7107
7747
|
);
|
|
7108
7748
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
7109
|
-
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mEnabling
|
|
7749
|
+
"[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
|
|
7110
7750
|
|
|
7111
7751
|
|
|
7112
7752
|
[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m\`--node-compat\` and \`--no-bundle\` can't be used together. If you want to polyfill Node.js built-ins and disable Wrangler's bundling, please polyfill as part of your own bundling process.[0m
|
|
@@ -7126,7 +7766,7 @@ export default{
|
|
|
7126
7766
|
fs.writeFileSync("index.js", scriptContent);
|
|
7127
7767
|
await runWrangler("publish index.js --dry-run --outdir dist");
|
|
7128
7768
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
7129
|
-
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mEnabling
|
|
7769
|
+
"[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
|
|
7130
7770
|
|
|
7131
7771
|
|
|
7132
7772
|
[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m\`--node-compat\` and \`--no-bundle\` can't be used together. If you want to polyfill Node.js built-ins and disable Wrangler's bundling, please polyfill as part of your own bundling process.[0m
|
|
@@ -7136,53 +7776,6 @@ export default{
|
|
|
7136
7776
|
});
|
|
7137
7777
|
});
|
|
7138
7778
|
|
|
7139
|
-
it("should publish if the last deployed source check fails", async () => {
|
|
7140
|
-
writeWorkerSource();
|
|
7141
|
-
writeWranglerToml();
|
|
7142
|
-
mockSubDomainRequest();
|
|
7143
|
-
mockUploadWorkerRequest();
|
|
7144
|
-
msw.use(
|
|
7145
|
-
rest.get(
|
|
7146
|
-
"*/accounts/:accountId/workers/deployments/by-script/:scriptTag",
|
|
7147
|
-
(_, res, ctx) => {
|
|
7148
|
-
return res(
|
|
7149
|
-
ctx.json(
|
|
7150
|
-
createFetchResult({
|
|
7151
|
-
latest: { number: "2" },
|
|
7152
|
-
})
|
|
7153
|
-
)
|
|
7154
|
-
);
|
|
7155
|
-
}
|
|
7156
|
-
),
|
|
7157
|
-
rest.get(
|
|
7158
|
-
"*/accounts/:accountId/workers/services/:scriptName",
|
|
7159
|
-
(_, res, ctx) => {
|
|
7160
|
-
return res(
|
|
7161
|
-
ctx.json(
|
|
7162
|
-
createFetchResult(null, false, [
|
|
7163
|
-
{ code: 10090, message: "workers.api.error.service_not_found" },
|
|
7164
|
-
])
|
|
7165
|
-
)
|
|
7166
|
-
);
|
|
7167
|
-
}
|
|
7168
|
-
)
|
|
7169
|
-
);
|
|
7170
|
-
|
|
7171
|
-
await runWrangler("publish index.js");
|
|
7172
|
-
expect(std).toMatchInlineSnapshot(`
|
|
7173
|
-
Object {
|
|
7174
|
-
"debug": "",
|
|
7175
|
-
"err": "",
|
|
7176
|
-
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7177
|
-
Uploaded test-name (TIMINGS)
|
|
7178
|
-
Published test-name (TIMINGS)
|
|
7179
|
-
https://test-name.test-sub-domain.workers.dev
|
|
7180
|
-
Current Deployment ID: undefined",
|
|
7181
|
-
"warn": "",
|
|
7182
|
-
}
|
|
7183
|
-
`);
|
|
7184
|
-
});
|
|
7185
|
-
|
|
7186
7779
|
it("should not publish if there's any other kind of error when checking deployment source", async () => {
|
|
7187
7780
|
writeWorkerSource();
|
|
7188
7781
|
writeWranglerToml();
|
|
@@ -7292,6 +7885,83 @@ export default{
|
|
|
7292
7885
|
`);
|
|
7293
7886
|
});
|
|
7294
7887
|
|
|
7888
|
+
it("should support queue consumer concurrency with a max concurrency specified", async () => {
|
|
7889
|
+
writeWranglerToml({
|
|
7890
|
+
queues: {
|
|
7891
|
+
consumers: [
|
|
7892
|
+
{
|
|
7893
|
+
queue: "queue1",
|
|
7894
|
+
dead_letter_queue: "myDLQ",
|
|
7895
|
+
max_batch_size: 5,
|
|
7896
|
+
max_batch_timeout: 3,
|
|
7897
|
+
max_retries: 10,
|
|
7898
|
+
max_concurrency: 5,
|
|
7899
|
+
},
|
|
7900
|
+
],
|
|
7901
|
+
},
|
|
7902
|
+
});
|
|
7903
|
+
await fs.promises.writeFile("index.js", `export default {};`);
|
|
7904
|
+
mockSubDomainRequest();
|
|
7905
|
+
mockUploadWorkerRequest();
|
|
7906
|
+
mockGetQueue("queue1");
|
|
7907
|
+
mockPutQueueConsumer("queue1", "test-name", {
|
|
7908
|
+
dead_letter_queue: "myDLQ",
|
|
7909
|
+
settings: {
|
|
7910
|
+
batch_size: 5,
|
|
7911
|
+
max_retries: 10,
|
|
7912
|
+
max_wait_time_ms: 3000,
|
|
7913
|
+
max_concurrency: 5,
|
|
7914
|
+
},
|
|
7915
|
+
});
|
|
7916
|
+
await runWrangler("publish index.js");
|
|
7917
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
7918
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
7919
|
+
Uploaded test-name (TIMINGS)
|
|
7920
|
+
Published test-name (TIMINGS)
|
|
7921
|
+
https://test-name.test-sub-domain.workers.dev
|
|
7922
|
+
Consumer for queue1
|
|
7923
|
+
Current Deployment ID: Galaxy-Class"
|
|
7924
|
+
`);
|
|
7925
|
+
});
|
|
7926
|
+
|
|
7927
|
+
it("should support queue consumer concurrency with a null max concurrency", async () => {
|
|
7928
|
+
writeWranglerToml({
|
|
7929
|
+
queues: {
|
|
7930
|
+
consumers: [
|
|
7931
|
+
{
|
|
7932
|
+
queue: "queue1",
|
|
7933
|
+
dead_letter_queue: "myDLQ",
|
|
7934
|
+
max_batch_size: 5,
|
|
7935
|
+
max_batch_timeout: 3,
|
|
7936
|
+
max_retries: 10,
|
|
7937
|
+
max_concurrency: null,
|
|
7938
|
+
},
|
|
7939
|
+
],
|
|
7940
|
+
},
|
|
7941
|
+
});
|
|
7942
|
+
await fs.promises.writeFile("index.js", `export default {};`);
|
|
7943
|
+
mockSubDomainRequest();
|
|
7944
|
+
mockUploadWorkerRequest();
|
|
7945
|
+
mockGetQueue("queue1");
|
|
7946
|
+
mockPutQueueConsumer("queue1", "test-name", {
|
|
7947
|
+
dead_letter_queue: "myDLQ",
|
|
7948
|
+
settings: {
|
|
7949
|
+
batch_size: 5,
|
|
7950
|
+
max_retries: 10,
|
|
7951
|
+
max_wait_time_ms: 3000,
|
|
7952
|
+
},
|
|
7953
|
+
});
|
|
7954
|
+
await runWrangler("publish index.js");
|
|
7955
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
7956
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
7957
|
+
Uploaded test-name (TIMINGS)
|
|
7958
|
+
Published test-name (TIMINGS)
|
|
7959
|
+
https://test-name.test-sub-domain.workers.dev
|
|
7960
|
+
Consumer for queue1
|
|
7961
|
+
Current Deployment ID: Galaxy-Class"
|
|
7962
|
+
`);
|
|
7963
|
+
});
|
|
7964
|
+
|
|
7295
7965
|
it("consumer should error when a queue doesn't exist", async () => {
|
|
7296
7966
|
writeWranglerToml({
|
|
7297
7967
|
queues: {
|
|
@@ -7420,6 +8090,33 @@ export default{
|
|
|
7420
8090
|
`);
|
|
7421
8091
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
7422
8092
|
});
|
|
8093
|
+
|
|
8094
|
+
it("should send keepVars when `keep_vars = true`", async () => {
|
|
8095
|
+
process.env = {
|
|
8096
|
+
CLOUDFLARE_API_TOKEN: "hunter2",
|
|
8097
|
+
CLOUDFLARE_ACCOUNT_ID: "some-account-id",
|
|
8098
|
+
};
|
|
8099
|
+
setIsTTY(false);
|
|
8100
|
+
writeWranglerToml({
|
|
8101
|
+
keep_vars: true,
|
|
8102
|
+
});
|
|
8103
|
+
writeWorkerSource();
|
|
8104
|
+
mockSubDomainRequest();
|
|
8105
|
+
mockUploadWorkerRequest({ keepVars: true });
|
|
8106
|
+
mockOAuthServerCallback();
|
|
8107
|
+
mockGetMemberships([]);
|
|
8108
|
+
|
|
8109
|
+
await runWrangler("publish index.js");
|
|
8110
|
+
|
|
8111
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
8112
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
8113
|
+
Uploaded test-name (TIMINGS)
|
|
8114
|
+
Published test-name (TIMINGS)
|
|
8115
|
+
https://test-name.test-sub-domain.workers.dev
|
|
8116
|
+
Current Deployment ID: Galaxy-Class"
|
|
8117
|
+
`);
|
|
8118
|
+
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
8119
|
+
});
|
|
7423
8120
|
});
|
|
7424
8121
|
});
|
|
7425
8122
|
|
|
@@ -7441,14 +8138,14 @@ function mockDeploymentsListRequest() {
|
|
|
7441
8138
|
}
|
|
7442
8139
|
|
|
7443
8140
|
function mockLastDeploymentRequest() {
|
|
7444
|
-
msw.use(...
|
|
8141
|
+
msw.use(...mswSuccessDeploymentScriptMetadata);
|
|
7445
8142
|
}
|
|
7446
8143
|
|
|
7447
8144
|
/** Create a mock handler for the request to upload a worker script. */
|
|
7448
8145
|
function mockUploadWorkerRequest(
|
|
7449
8146
|
options: {
|
|
7450
8147
|
available_on_subdomain?: boolean;
|
|
7451
|
-
expectedEntry?: string;
|
|
8148
|
+
expectedEntry?: string | RegExp;
|
|
7452
8149
|
expectedMainModule?: string;
|
|
7453
8150
|
expectedType?: "esm" | "sw";
|
|
7454
8151
|
expectedBindings?: unknown;
|
|
@@ -7456,9 +8153,9 @@ function mockUploadWorkerRequest(
|
|
|
7456
8153
|
expectedCompatibilityDate?: string;
|
|
7457
8154
|
expectedCompatibilityFlags?: string[];
|
|
7458
8155
|
expectedMigrations?: CfWorkerInit["migrations"];
|
|
8156
|
+
expectedUnsafeMetaData?: Record<string, string>;
|
|
7459
8157
|
env?: string;
|
|
7460
8158
|
legacyEnv?: boolean;
|
|
7461
|
-
sendScriptIds?: boolean;
|
|
7462
8159
|
keepVars?: boolean;
|
|
7463
8160
|
tag?: string;
|
|
7464
8161
|
} = {}
|
|
@@ -7475,7 +8172,7 @@ function mockUploadWorkerRequest(
|
|
|
7475
8172
|
env = undefined,
|
|
7476
8173
|
legacyEnv = false,
|
|
7477
8174
|
expectedMigrations,
|
|
7478
|
-
|
|
8175
|
+
expectedUnsafeMetaData,
|
|
7479
8176
|
keepVars,
|
|
7480
8177
|
} = options;
|
|
7481
8178
|
if (env && !legacyEnv) {
|
|
@@ -7544,6 +8241,11 @@ function mockUploadWorkerRequest(
|
|
|
7544
8241
|
if ("expectedMigrations" in options) {
|
|
7545
8242
|
expect(metadata.migrations).toEqual(expectedMigrations);
|
|
7546
8243
|
}
|
|
8244
|
+
if (expectedUnsafeMetaData !== undefined) {
|
|
8245
|
+
Object.keys(expectedUnsafeMetaData).forEach((key) => {
|
|
8246
|
+
expect(metadata[key]).toEqual(expectedUnsafeMetaData[key]);
|
|
8247
|
+
});
|
|
8248
|
+
}
|
|
7547
8249
|
for (const [name, content] of Object.entries(expectedModules)) {
|
|
7548
8250
|
expect(formBody.get(name)).toEqual(content);
|
|
7549
8251
|
}
|
|
@@ -7552,12 +8254,11 @@ function mockUploadWorkerRequest(
|
|
|
7552
8254
|
ctx.json(
|
|
7553
8255
|
createFetchResult({
|
|
7554
8256
|
available_on_subdomain,
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
}),
|
|
8257
|
+
id: "abc12345",
|
|
8258
|
+
etag: "etag98765",
|
|
8259
|
+
pipeline_hash: "hash9999",
|
|
8260
|
+
tag: "sample-tag",
|
|
8261
|
+
deployment_id: "Galaxy-Class",
|
|
7561
8262
|
})
|
|
7562
8263
|
)
|
|
7563
8264
|
);
|