wrangler 0.0.0-e33bea9b → 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/miniflare-dist/index.mjs +167 -93
- package/package.json +14 -9
- package/src/__tests__/api-devregistry.test.ts +121 -0
- package/src/__tests__/api.test.ts +27 -5
- package/src/__tests__/configuration.test.ts +59 -12
- package/src/__tests__/constellation.test.ts +371 -0
- package/src/__tests__/d1/execute.test.ts +2 -0
- 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 +71 -56
- package/src/__tests__/generate.test.ts +3 -4
- 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 +127 -96
- 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 +2 -2
- 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 +70 -0
- 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 +136 -92
- package/src/__tests__/publish.test.ts +878 -332
- package/src/__tests__/pubsub.test.ts +3 -0
- package/src/__tests__/queues.test.ts +5 -2
- package/src/__tests__/traverse-module-graph.test.ts +220 -0
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/user.test.ts +1 -1
- package/src/__tests__/worker-namespace.test.ts +1 -0
- package/src/api/dev.ts +12 -18
- package/src/api/pages/create-worker-bundle-contents.ts +1 -0
- package/src/api/pages/publish.tsx +28 -12
- package/src/bundle.ts +26 -9
- package/src/config/environment.ts +27 -0
- package/src/config/index.ts +18 -0
- package/src/config/validation.ts +91 -1
- 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-upload-form.ts +18 -1
- 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 +2 -0
- package/src/dev/local.tsx +48 -20
- package/src/dev/start-server.ts +49 -46
- package/src/dev/use-esbuild.ts +52 -49
- package/src/dev-registry.ts +2 -1
- package/src/dev.tsx +11 -5
- package/src/docs/helpers.ts +50 -0
- package/src/docs/index.ts +25 -68
- package/src/entry.ts +19 -8
- package/src/environment-variables/factory.ts +2 -1
- package/src/generate/index.ts +2 -2
- package/src/index.ts +86 -23
- package/src/init.ts +144 -135
- 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/index.ts +2 -2
- package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
- package/src/module-collection.ts +92 -26
- package/src/pages/build.ts +29 -17
- package/src/pages/deployments.tsx +3 -5
- package/src/pages/dev.ts +24 -6
- package/src/pages/functions/buildPlugin.ts +1 -0
- package/src/pages/functions/buildWorker.ts +59 -8
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/pages/projects.tsx +2 -5
- package/src/pages/upload.tsx +24 -4
- package/src/publish/publish.ts +10 -26
- package/src/queues/cli/commands/consumer/add.ts +6 -0
- package/src/queues/client.ts +1 -0
- package/src/secret/index.ts +1 -0
- package/src/sites.ts +164 -52
- package/src/traverse-module-graph.ts +53 -0
- package/src/user/user.ts +1 -0
- package/src/utils/render.ts +93 -0
- package/src/worker.ts +10 -0
- package/wrangler-dist/cli.d.ts +29 -2
- package/wrangler-dist/cli.js +23270 -22110
- 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)
|
|
@@ -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)
|
|
@@ -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)
|
|
@@ -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 () => {
|
|
@@ -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)
|
|
@@ -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
|
-
|
|
2802
|
-
|
|
2875
|
+
Current Deployment ID: Galaxy-Class"
|
|
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]"
|
|
2803
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)
|
|
@@ -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:
|
|
@@ -5555,6 +6029,7 @@ addEventListener('fetch', event => {});`
|
|
|
5555
6029
|
Object {
|
|
5556
6030
|
"debug": "",
|
|
5557
6031
|
"err": "",
|
|
6032
|
+
"info": "",
|
|
5558
6033
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
5559
6034
|
Your worker has access to the following bindings:
|
|
5560
6035
|
- Vars:
|
|
@@ -6495,6 +6970,7 @@ addEventListener('fetch', event => {});`
|
|
|
6495
6970
|
Object {
|
|
6496
6971
|
"debug": "",
|
|
6497
6972
|
"err": "",
|
|
6973
|
+
"info": "",
|
|
6498
6974
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6499
6975
|
Uploaded test-name (TIMINGS)
|
|
6500
6976
|
Published test-name (TIMINGS)
|
|
@@ -6545,6 +7021,7 @@ addEventListener('fetch', event => {});`
|
|
|
6545
7021
|
Object {
|
|
6546
7022
|
"debug": "",
|
|
6547
7023
|
"err": "",
|
|
7024
|
+
"info": "",
|
|
6548
7025
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6549
7026
|
Uploaded test-name (TIMINGS)
|
|
6550
7027
|
Published test-name (TIMINGS)
|
|
@@ -6569,6 +7046,7 @@ addEventListener('fetch', event => {});`
|
|
|
6569
7046
|
Object {
|
|
6570
7047
|
"debug": "",
|
|
6571
7048
|
"err": "",
|
|
7049
|
+
"info": "",
|
|
6572
7050
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6573
7051
|
Uploaded test-name (TIMINGS)
|
|
6574
7052
|
Published test-name (TIMINGS)
|
|
@@ -6603,11 +7081,13 @@ addEventListener('fetch', event => {});`
|
|
|
6603
7081
|
Object {
|
|
6604
7082
|
"debug": "",
|
|
6605
7083
|
"err": "",
|
|
6606
|
-
"
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
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
|
|
6611
7091
|
Total Upload: xx KiB / gzip: xx KiB
|
|
6612
7092
|
Uploaded test-name (TIMINGS)
|
|
6613
7093
|
Published test-name (TIMINGS)
|
|
@@ -6665,6 +7145,7 @@ export default{
|
|
|
6665
7145
|
Object {
|
|
6666
7146
|
"debug": "",
|
|
6667
7147
|
"err": "",
|
|
7148
|
+
"info": "",
|
|
6668
7149
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6669
7150
|
Uploaded test-name (TIMINGS)
|
|
6670
7151
|
Published test-name (TIMINGS)
|
|
@@ -6693,6 +7174,7 @@ export default{
|
|
|
6693
7174
|
Object {
|
|
6694
7175
|
"debug": "",
|
|
6695
7176
|
"err": "",
|
|
7177
|
+
"info": "",
|
|
6696
7178
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6697
7179
|
Your worker has access to the following bindings:
|
|
6698
7180
|
- Durable Objects:
|
|
@@ -6710,16 +7192,17 @@ export default{
|
|
|
6710
7192
|
writeWorkerSource();
|
|
6711
7193
|
await runWrangler("publish index.js --node-compat --dry-run");
|
|
6712
7194
|
expect(std).toMatchInlineSnapshot(`
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
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
|
+
`);
|
|
6723
7206
|
});
|
|
6724
7207
|
|
|
6725
7208
|
it("should recommend node compatibility mode when using node builtins and node-compat isn't enabled", async () => {
|
|
@@ -6757,16 +7240,17 @@ export default{
|
|
|
6757
7240
|
);
|
|
6758
7241
|
await runWrangler("publish index.js --node-compat --dry-run"); // this would throw if node compatibility didn't exist
|
|
6759
7242
|
expect(std).toMatchInlineSnapshot(`
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
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
|
+
`);
|
|
6770
7254
|
});
|
|
6771
7255
|
});
|
|
6772
7256
|
|
|
@@ -6811,6 +7295,7 @@ export default{
|
|
|
6811
7295
|
Object {
|
|
6812
7296
|
"debug": "",
|
|
6813
7297
|
"err": "",
|
|
7298
|
+
"info": "",
|
|
6814
7299
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6815
7300
|
--dry-run: exiting now.",
|
|
6816
7301
|
"warn": "",
|
|
@@ -6883,6 +7368,7 @@ export default{
|
|
|
6883
7368
|
Object {
|
|
6884
7369
|
"debug": "",
|
|
6885
7370
|
"err": "",
|
|
7371
|
+
"info": "",
|
|
6886
7372
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6887
7373
|
Uploaded test-name (TIMINGS)
|
|
6888
7374
|
Published test-name (TIMINGS)
|
|
@@ -6945,23 +7431,24 @@ export default{
|
|
|
6945
7431
|
`[ParseError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
|
|
6946
7432
|
);
|
|
6947
7433
|
expect(std).toMatchInlineSnapshot(`
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
7434
|
+
Object {
|
|
7435
|
+
"debug": "",
|
|
7436
|
+
"err": "",
|
|
7437
|
+
"info": "",
|
|
7438
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6952
7439
|
|
|
6953
|
-
|
|
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
|
|
6954
7441
|
|
|
6955
|
-
|
|
6956
|
-
|
|
7442
|
+
Script startup timed out. This could be due to script exceeding size limits or expensive code in
|
|
7443
|
+
the global scope. [code: 11337]
|
|
6957
7444
|
|
|
6958
|
-
|
|
6959
|
-
|
|
7445
|
+
If you think this is a bug, please open an issue at:
|
|
7446
|
+
[4mhttps://github.com/cloudflare/workers-sdk/issues/new/choose[0m
|
|
6960
7447
|
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
7448
|
+
",
|
|
7449
|
+
"warn": "",
|
|
7450
|
+
}
|
|
7451
|
+
`);
|
|
6965
7452
|
});
|
|
6966
7453
|
|
|
6967
7454
|
test("should check biggest dependencies when upload fails with script size error", async () => {
|
|
@@ -7011,6 +7498,7 @@ export default{
|
|
|
7011
7498
|
Object {
|
|
7012
7499
|
"debug": "",
|
|
7013
7500
|
"err": "",
|
|
7501
|
+
"info": "",
|
|
7014
7502
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7015
7503
|
|
|
7016
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
|
|
@@ -7077,6 +7565,7 @@ export default{
|
|
|
7077
7565
|
Object {
|
|
7078
7566
|
"debug": "",
|
|
7079
7567
|
"err": "",
|
|
7568
|
+
"info": "",
|
|
7080
7569
|
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7081
7570
|
|
|
7082
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
|
|
@@ -7115,6 +7604,7 @@ export default{
|
|
|
7115
7604
|
Object {
|
|
7116
7605
|
"debug": "",
|
|
7117
7606
|
"err": "",
|
|
7607
|
+
"info": "",
|
|
7118
7608
|
"out": "Total Upload: xx KiB / gzip: xx KiB",
|
|
7119
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
|
|
7120
7610
|
|
|
@@ -7137,6 +7627,7 @@ export default{
|
|
|
7137
7627
|
Object {
|
|
7138
7628
|
"debug": "",
|
|
7139
7629
|
"err": "",
|
|
7630
|
+
"info": "",
|
|
7140
7631
|
"out": "Total Upload: xx KiB / gzip: xx KiB",
|
|
7141
7632
|
"warn": "",
|
|
7142
7633
|
}
|
|
@@ -7165,6 +7656,7 @@ export default{
|
|
|
7165
7656
|
Object {
|
|
7166
7657
|
"debug": "",
|
|
7167
7658
|
"err": "",
|
|
7659
|
+
"info": "",
|
|
7168
7660
|
"out": "",
|
|
7169
7661
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mHere are the 5 largest dependencies included in your script:[0m
|
|
7170
7662
|
|
|
@@ -7284,53 +7776,6 @@ export default{
|
|
|
7284
7776
|
});
|
|
7285
7777
|
});
|
|
7286
7778
|
|
|
7287
|
-
it("should publish if the last deployed source check fails", async () => {
|
|
7288
|
-
writeWorkerSource();
|
|
7289
|
-
writeWranglerToml();
|
|
7290
|
-
mockSubDomainRequest();
|
|
7291
|
-
mockUploadWorkerRequest();
|
|
7292
|
-
msw.use(
|
|
7293
|
-
rest.get(
|
|
7294
|
-
"*/accounts/:accountId/workers/deployments/by-script/:scriptTag",
|
|
7295
|
-
(_, res, ctx) => {
|
|
7296
|
-
return res(
|
|
7297
|
-
ctx.json(
|
|
7298
|
-
createFetchResult({
|
|
7299
|
-
latest: { number: "2" },
|
|
7300
|
-
})
|
|
7301
|
-
)
|
|
7302
|
-
);
|
|
7303
|
-
}
|
|
7304
|
-
),
|
|
7305
|
-
rest.get(
|
|
7306
|
-
"*/accounts/:accountId/workers/services/:scriptName",
|
|
7307
|
-
(_, res, ctx) => {
|
|
7308
|
-
return res(
|
|
7309
|
-
ctx.json(
|
|
7310
|
-
createFetchResult(null, false, [
|
|
7311
|
-
{ code: 10090, message: "workers.api.error.service_not_found" },
|
|
7312
|
-
])
|
|
7313
|
-
)
|
|
7314
|
-
);
|
|
7315
|
-
}
|
|
7316
|
-
)
|
|
7317
|
-
);
|
|
7318
|
-
|
|
7319
|
-
await runWrangler("publish index.js");
|
|
7320
|
-
expect(std).toMatchInlineSnapshot(`
|
|
7321
|
-
Object {
|
|
7322
|
-
"debug": "",
|
|
7323
|
-
"err": "",
|
|
7324
|
-
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
7325
|
-
Uploaded test-name (TIMINGS)
|
|
7326
|
-
Published test-name (TIMINGS)
|
|
7327
|
-
https://test-name.test-sub-domain.workers.dev
|
|
7328
|
-
Current Deployment ID: undefined",
|
|
7329
|
-
"warn": "",
|
|
7330
|
-
}
|
|
7331
|
-
`);
|
|
7332
|
-
});
|
|
7333
|
-
|
|
7334
7779
|
it("should not publish if there's any other kind of error when checking deployment source", async () => {
|
|
7335
7780
|
writeWorkerSource();
|
|
7336
7781
|
writeWranglerToml();
|
|
@@ -7440,6 +7885,83 @@ export default{
|
|
|
7440
7885
|
`);
|
|
7441
7886
|
});
|
|
7442
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
|
+
|
|
7443
7965
|
it("consumer should error when a queue doesn't exist", async () => {
|
|
7444
7966
|
writeWranglerToml({
|
|
7445
7967
|
queues: {
|
|
@@ -7568,6 +8090,33 @@ export default{
|
|
|
7568
8090
|
`);
|
|
7569
8091
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
7570
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
|
+
});
|
|
7571
8120
|
});
|
|
7572
8121
|
});
|
|
7573
8122
|
|
|
@@ -7589,7 +8138,7 @@ function mockDeploymentsListRequest() {
|
|
|
7589
8138
|
}
|
|
7590
8139
|
|
|
7591
8140
|
function mockLastDeploymentRequest() {
|
|
7592
|
-
msw.use(...
|
|
8141
|
+
msw.use(...mswSuccessDeploymentScriptMetadata);
|
|
7593
8142
|
}
|
|
7594
8143
|
|
|
7595
8144
|
/** Create a mock handler for the request to upload a worker script. */
|
|
@@ -7607,7 +8156,6 @@ function mockUploadWorkerRequest(
|
|
|
7607
8156
|
expectedUnsafeMetaData?: Record<string, string>;
|
|
7608
8157
|
env?: string;
|
|
7609
8158
|
legacyEnv?: boolean;
|
|
7610
|
-
sendScriptIds?: boolean;
|
|
7611
8159
|
keepVars?: boolean;
|
|
7612
8160
|
tag?: string;
|
|
7613
8161
|
} = {}
|
|
@@ -7625,7 +8173,6 @@ function mockUploadWorkerRequest(
|
|
|
7625
8173
|
legacyEnv = false,
|
|
7626
8174
|
expectedMigrations,
|
|
7627
8175
|
expectedUnsafeMetaData,
|
|
7628
|
-
sendScriptIds,
|
|
7629
8176
|
keepVars,
|
|
7630
8177
|
} = options;
|
|
7631
8178
|
if (env && !legacyEnv) {
|
|
@@ -7707,12 +8254,11 @@ function mockUploadWorkerRequest(
|
|
|
7707
8254
|
ctx.json(
|
|
7708
8255
|
createFetchResult({
|
|
7709
8256
|
available_on_subdomain,
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
}),
|
|
8257
|
+
id: "abc12345",
|
|
8258
|
+
etag: "etag98765",
|
|
8259
|
+
pipeline_hash: "hash9999",
|
|
8260
|
+
tag: "sample-tag",
|
|
8261
|
+
deployment_id: "Galaxy-Class",
|
|
7716
8262
|
})
|
|
7717
8263
|
)
|
|
7718
8264
|
);
|