wrangler 0.0.0-e6c9c5c0 → 0.0.0-e6e1daba
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/README.md +3 -3
- package/miniflare-dist/index.mjs +22 -18
- package/package.json +12 -12
- package/src/__tests__/configuration.test.ts +70 -0
- package/src/__tests__/d1/d1.test.ts +13 -58
- package/src/__tests__/d1/execute.test.ts +64 -0
- package/src/__tests__/d1/migrate.test.ts +155 -0
- package/src/__tests__/deployments.test.ts +40 -16
- package/src/__tests__/dev.test.tsx +8 -7
- package/src/__tests__/generate.test.ts +1 -1
- package/src/__tests__/guess-worker-format.test.ts +35 -0
- package/src/__tests__/helpers/end-event-loop.ts +6 -0
- package/src/__tests__/helpers/mock-get-pages-upload-token.ts +25 -0
- package/src/__tests__/helpers/mock-set-timeout.ts +16 -0
- package/src/__tests__/helpers/msw/handlers/deployments.ts +40 -16
- package/src/__tests__/helpers/string-dynamic-values-matcher.ts +28 -0
- package/src/__tests__/index.test.ts +38 -32
- package/src/__tests__/init.test.ts +1 -1
- package/src/__tests__/kv.test.ts +63 -52
- package/src/__tests__/middleware.test.ts +65 -0
- package/src/__tests__/mtls-certificates.test.ts +585 -0
- package/src/__tests__/pages/deployment-list.test.ts +78 -0
- package/src/__tests__/pages/functions-build.test.ts +402 -0
- package/src/__tests__/pages/pages.test.ts +81 -0
- package/src/__tests__/pages/project-create.test.ts +63 -0
- package/src/__tests__/pages/project-list.test.ts +108 -0
- package/src/__tests__/pages/project-upload.test.ts +481 -0
- package/src/__tests__/pages/publish.test.ts +2745 -0
- package/src/__tests__/parse.test.ts +106 -0
- package/src/__tests__/publish.test.ts +80 -30
- package/src/__tests__/pubsub.test.ts +15 -12
- package/src/__tests__/queues.test.ts +37 -30
- package/src/__tests__/r2.test.ts +25 -20
- package/src/__tests__/secret.test.ts +4 -4
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/user.test.ts +1 -1
- package/src/__tests__/whoami.test.tsx +1 -1
- package/src/__tests__/worker-namespace.test.ts +26 -21
- package/src/api/dev.ts +80 -11
- package/src/api/index.ts +8 -0
- package/src/api/mtls-certificate.ts +148 -0
- package/src/api/pages/create-worker-bundle-contents.ts +75 -0
- package/src/api/pages/publish.tsx +59 -12
- package/src/bundle.ts +9 -7
- package/src/config/config.ts +14 -7
- package/src/config/environment.ts +9 -2
- package/src/config/index.ts +37 -20
- package/src/config/validation.ts +50 -3
- package/src/create-worker-preview.ts +19 -8
- package/src/create-worker-upload-form.ts +9 -0
- package/src/d1/backups.tsx +20 -24
- package/src/d1/create.tsx +6 -5
- package/src/d1/delete.ts +7 -10
- package/src/d1/execute.tsx +174 -143
- package/src/d1/index.ts +5 -6
- package/src/d1/list.tsx +21 -9
- package/src/d1/migrations/apply.tsx +42 -33
- package/src/d1/migrations/create.tsx +16 -17
- package/src/d1/migrations/helpers.ts +63 -38
- package/src/d1/migrations/list.tsx +37 -24
- package/src/d1/migrations/options.ts +7 -2
- package/src/d1/options.ts +3 -3
- package/src/d1/types.ts +1 -0
- package/src/d1/utils.ts +2 -1
- package/src/delete.ts +5 -8
- package/src/deployments.ts +62 -39
- package/src/deprecated/index.ts +7 -8
- package/src/dev/dev.tsx +1 -15
- package/src/dev/local.tsx +5 -6
- package/src/dev/remote.tsx +2 -2
- package/src/dev.tsx +51 -86
- package/src/dispatch-namespace.ts +20 -16
- package/src/docs/index.ts +7 -8
- package/src/entry.ts +1 -2
- package/src/generate/index.ts +6 -8
- package/src/index.ts +37 -26
- package/src/init.ts +5 -7
- package/src/inspect.ts +16 -1
- package/src/kv/index.ts +15 -17
- package/src/miniflare-cli/assets.ts +9 -8
- package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
- package/src/mtls-certificate/cli.ts +155 -0
- package/src/pages/build.ts +109 -27
- package/src/pages/buildFunctions.ts +32 -31
- package/src/pages/deployment-tails.ts +7 -10
- package/src/pages/deployments.tsx +6 -4
- package/src/pages/dev.ts +19 -19
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/pages/functions.ts +8 -4
- package/src/pages/index.ts +3 -3
- package/src/pages/projects.tsx +7 -12
- package/src/pages/publish.tsx +18 -5
- package/src/pages/types.ts +5 -0
- package/src/pages/upload.tsx +6 -4
- package/src/pages/utils.ts +1 -1
- package/src/parse.ts +23 -1
- package/src/publish/index.ts +19 -15
- package/src/publish/publish.ts +5 -4
- package/src/pubsub/pubsub-commands.ts +18 -19
- package/src/queues/cli/commands/consumer/add.ts +18 -24
- package/src/queues/cli/commands/consumer/index.ts +3 -6
- package/src/queues/cli/commands/consumer/remove.ts +11 -18
- package/src/queues/cli/commands/create.ts +8 -8
- package/src/queues/cli/commands/delete.ts +8 -8
- package/src/queues/cli/commands/index.ts +3 -4
- package/src/queues/cli/commands/list.ts +8 -8
- package/src/r2/helpers.ts +1 -0
- package/src/r2/index.ts +28 -28
- package/src/secret/index.ts +10 -14
- package/src/sites.ts +1 -1
- package/src/tail/filters.ts +1 -1
- package/src/tail/index.ts +6 -8
- package/src/user/user.ts +4 -3
- package/src/worker.ts +6 -0
- package/src/yargs-types.ts +18 -5
- package/templates/checked-fetch.js +9 -1
- package/templates/format-dev-errors.ts +1 -0
- package/templates/new-worker.ts +3 -0
- package/templates/pages-template-plugin.ts +7 -3
- package/templates/serve-static-assets.ts +1 -0
- package/templates/service-bindings-module-facade.js +1 -0
- package/templates/tsconfig.init.json +1 -1
- package/templates/tsconfig.tsbuildinfo +1 -1
- package/wrangler-dist/cli.d.ts +596 -3
- package/wrangler-dist/cli.js +14276 -6748
- package/src/__tests__/pages.test.ts +0 -2898
package/src/__tests__/kv.test.ts
CHANGED
|
@@ -63,10 +63,11 @@ describe("wrangler", () => {
|
|
|
63
63
|
namespace The name of the new namespace [string] [required]
|
|
64
64
|
|
|
65
65
|
Flags:
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
66
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
67
|
+
-c, --config Path to .toml configuration file [string]
|
|
68
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
69
|
+
-h, --help Show help [boolean]
|
|
70
|
+
-v, --version Show version number [boolean]
|
|
70
71
|
|
|
71
72
|
Options:
|
|
72
73
|
--preview Interact with a preview namespace [boolean]"
|
|
@@ -94,10 +95,11 @@ describe("wrangler", () => {
|
|
|
94
95
|
namespace The name of the new namespace [string] [required]
|
|
95
96
|
|
|
96
97
|
Flags:
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
98
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
99
|
+
-c, --config Path to .toml configuration file [string]
|
|
100
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
101
|
+
-h, --help Show help [boolean]
|
|
102
|
+
-v, --version Show version number [boolean]
|
|
101
103
|
|
|
102
104
|
Options:
|
|
103
105
|
--preview Interact with a preview namespace [boolean]"
|
|
@@ -126,10 +128,11 @@ describe("wrangler", () => {
|
|
|
126
128
|
namespace The name of the new namespace [string] [required]
|
|
127
129
|
|
|
128
130
|
Flags:
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
131
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
132
|
+
-c, --config Path to .toml configuration file [string]
|
|
133
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
134
|
+
-h, --help Show help [boolean]
|
|
135
|
+
-v, --version Show version number [boolean]
|
|
133
136
|
|
|
134
137
|
Options:
|
|
135
138
|
--preview Interact with a preview namespace [boolean]"
|
|
@@ -552,10 +555,11 @@ describe("wrangler", () => {
|
|
|
552
555
|
value The value to write [string]
|
|
553
556
|
|
|
554
557
|
Flags:
|
|
555
|
-
-
|
|
556
|
-
-
|
|
557
|
-
-
|
|
558
|
-
-
|
|
558
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
559
|
+
-c, --config Path to .toml configuration file [string]
|
|
560
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
561
|
+
-h, --help Show help [boolean]
|
|
562
|
+
-v, --version Show version number [boolean]
|
|
559
563
|
|
|
560
564
|
Options:
|
|
561
565
|
--binding The binding of the namespace to write to [string]
|
|
@@ -591,10 +595,11 @@ describe("wrangler", () => {
|
|
|
591
595
|
value The value to write [string]
|
|
592
596
|
|
|
593
597
|
Flags:
|
|
594
|
-
-
|
|
595
|
-
-
|
|
596
|
-
-
|
|
597
|
-
-
|
|
598
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
599
|
+
-c, --config Path to .toml configuration file [string]
|
|
600
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
601
|
+
-h, --help Show help [boolean]
|
|
602
|
+
-v, --version Show version number [boolean]
|
|
598
603
|
|
|
599
604
|
Options:
|
|
600
605
|
--binding The binding of the namespace to write to [string]
|
|
@@ -630,10 +635,11 @@ describe("wrangler", () => {
|
|
|
630
635
|
value The value to write [string]
|
|
631
636
|
|
|
632
637
|
Flags:
|
|
633
|
-
-
|
|
634
|
-
-
|
|
635
|
-
-
|
|
636
|
-
-
|
|
638
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
639
|
+
-c, --config Path to .toml configuration file [string]
|
|
640
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
641
|
+
-h, --help Show help [boolean]
|
|
642
|
+
-v, --version Show version number [boolean]
|
|
637
643
|
|
|
638
644
|
Options:
|
|
639
645
|
--binding The binding of the namespace to write to [string]
|
|
@@ -669,10 +675,11 @@ describe("wrangler", () => {
|
|
|
669
675
|
value The value to write [string]
|
|
670
676
|
|
|
671
677
|
Flags:
|
|
672
|
-
-
|
|
673
|
-
-
|
|
674
|
-
-
|
|
675
|
-
-
|
|
678
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
679
|
+
-c, --config Path to .toml configuration file [string]
|
|
680
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
681
|
+
-h, --help Show help [boolean]
|
|
682
|
+
-v, --version Show version number [boolean]
|
|
676
683
|
|
|
677
684
|
Options:
|
|
678
685
|
--binding The binding of the namespace to write to [string]
|
|
@@ -708,10 +715,11 @@ describe("wrangler", () => {
|
|
|
708
715
|
value The value to write [string]
|
|
709
716
|
|
|
710
717
|
Flags:
|
|
711
|
-
-
|
|
712
|
-
-
|
|
713
|
-
-
|
|
714
|
-
-
|
|
718
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
719
|
+
-c, --config Path to .toml configuration file [string]
|
|
720
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
721
|
+
-h, --help Show help [boolean]
|
|
722
|
+
-v, --version Show version number [boolean]
|
|
715
723
|
|
|
716
724
|
Options:
|
|
717
725
|
--binding The binding of the namespace to write to [string]
|
|
@@ -739,7 +747,7 @@ describe("wrangler", () => {
|
|
|
739
747
|
|
|
740
748
|
expect(std.out).toMatchInlineSnapshot(`
|
|
741
749
|
"
|
|
742
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
750
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
743
751
|
`);
|
|
744
752
|
expect(std.err).toMatchInlineSnapshot(`
|
|
745
753
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".[0m
|
|
@@ -761,7 +769,7 @@ describe("wrangler", () => {
|
|
|
761
769
|
);
|
|
762
770
|
expect(std.out).toMatchInlineSnapshot(`
|
|
763
771
|
"
|
|
764
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
772
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
765
773
|
`);
|
|
766
774
|
expect(std.err).toMatchInlineSnapshot(`
|
|
767
775
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1msomeBinding has both a namespace ID and a preview ID. Specify \\"--preview\\" or \\"--preview false\\" to avoid writing data to the wrong namespace.[0m
|
|
@@ -932,7 +940,7 @@ describe("wrangler", () => {
|
|
|
932
940
|
`);
|
|
933
941
|
expect(std.out).toMatchInlineSnapshot(`
|
|
934
942
|
"
|
|
935
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
943
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
936
944
|
`);
|
|
937
945
|
});
|
|
938
946
|
});
|
|
@@ -1083,10 +1091,11 @@ describe("wrangler", () => {
|
|
|
1083
1091
|
key The key value to get. [string] [required]
|
|
1084
1092
|
|
|
1085
1093
|
Flags:
|
|
1086
|
-
-
|
|
1087
|
-
-
|
|
1088
|
-
-
|
|
1089
|
-
-
|
|
1094
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
1095
|
+
-c, --config Path to .toml configuration file [string]
|
|
1096
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
1097
|
+
-h, --help Show help [boolean]
|
|
1098
|
+
-v, --version Show version number [boolean]
|
|
1090
1099
|
|
|
1091
1100
|
Options:
|
|
1092
1101
|
--binding The name of the namespace to get from [string]
|
|
@@ -1117,10 +1126,11 @@ describe("wrangler", () => {
|
|
|
1117
1126
|
key The key value to get. [string] [required]
|
|
1118
1127
|
|
|
1119
1128
|
Flags:
|
|
1120
|
-
-
|
|
1121
|
-
-
|
|
1122
|
-
-
|
|
1123
|
-
-
|
|
1129
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
1130
|
+
-c, --config Path to .toml configuration file [string]
|
|
1131
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
1132
|
+
-h, --help Show help [boolean]
|
|
1133
|
+
-v, --version Show version number [boolean]
|
|
1124
1134
|
|
|
1125
1135
|
Options:
|
|
1126
1136
|
--binding The name of the namespace to get from [string]
|
|
@@ -1152,10 +1162,11 @@ describe("wrangler", () => {
|
|
|
1152
1162
|
key The key value to get. [string] [required]
|
|
1153
1163
|
|
|
1154
1164
|
Flags:
|
|
1155
|
-
-
|
|
1156
|
-
-
|
|
1157
|
-
-
|
|
1158
|
-
-
|
|
1165
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
1166
|
+
-c, --config Path to .toml configuration file [string]
|
|
1167
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
1168
|
+
-h, --help Show help [boolean]
|
|
1169
|
+
-v, --version Show version number [boolean]
|
|
1159
1170
|
|
|
1160
1171
|
Options:
|
|
1161
1172
|
--binding The name of the namespace to get from [string]
|
|
@@ -1179,7 +1190,7 @@ describe("wrangler", () => {
|
|
|
1179
1190
|
);
|
|
1180
1191
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1181
1192
|
"
|
|
1182
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
1193
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
1183
1194
|
`);
|
|
1184
1195
|
expect(std.err).toMatchInlineSnapshot(`
|
|
1185
1196
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".[0m
|
|
@@ -1442,7 +1453,7 @@ describe("wrangler", () => {
|
|
|
1442
1453
|
`);
|
|
1443
1454
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1444
1455
|
"
|
|
1445
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
1456
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
1446
1457
|
`);
|
|
1447
1458
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
1448
1459
|
});
|
|
@@ -1504,7 +1515,7 @@ describe("wrangler", () => {
|
|
|
1504
1515
|
|
|
1505
1516
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1506
1517
|
"
|
|
1507
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
1518
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
1508
1519
|
`);
|
|
1509
1520
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
1510
1521
|
"[33mâ–² [43;33m[[43;30mWARNING[43;33m][0m [1mUnexpected key-value properties in \\"keys.json\\".[0m
|
|
@@ -1646,7 +1657,7 @@ describe("wrangler", () => {
|
|
|
1646
1657
|
`);
|
|
1647
1658
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1648
1659
|
"
|
|
1649
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
1660
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
1650
1661
|
`);
|
|
1651
1662
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
1652
1663
|
});
|
|
@@ -1671,7 +1682,7 @@ describe("wrangler", () => {
|
|
|
1671
1682
|
`);
|
|
1672
1683
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1673
1684
|
"
|
|
1674
|
-
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/
|
|
1685
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose[0m"
|
|
1675
1686
|
`);
|
|
1676
1687
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
1677
1688
|
});
|
|
@@ -748,3 +748,68 @@ describe("unchanged functionality when wrapping with middleware", () => {
|
|
|
748
748
|
});
|
|
749
749
|
});
|
|
750
750
|
});
|
|
751
|
+
|
|
752
|
+
describe("multiple middleware", () => {
|
|
753
|
+
it("should respond correctly with D1 databases, scheduled testing, and formatted dev errors", async () => {
|
|
754
|
+
// Kitchen sink test to check interaction between multiple middlewares
|
|
755
|
+
const scriptContent = `
|
|
756
|
+
export default {
|
|
757
|
+
async fetch(request, env, ctx) {
|
|
758
|
+
const { pathname } = new URL(request.url);
|
|
759
|
+
if (pathname === "/setup") {
|
|
760
|
+
await env.DB.exec("CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, value TEXT);");
|
|
761
|
+
return new Response(null, { status: 204 });
|
|
762
|
+
} else if (pathname === "/query") {
|
|
763
|
+
const rows = await env.DB.prepare("SELECT * FROM test;").all();
|
|
764
|
+
return Response.json(rows.results);
|
|
765
|
+
}
|
|
766
|
+
throw new Error("Not found!");
|
|
767
|
+
},
|
|
768
|
+
async scheduled(controller, env, ctx) {
|
|
769
|
+
const stmt = await env.DB.prepare("INSERT INTO test (id, value) VALUES (?, ?)");
|
|
770
|
+
await stmt.bind(1, "one").run();
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
`;
|
|
774
|
+
fs.writeFileSync("index.js", scriptContent);
|
|
775
|
+
|
|
776
|
+
const originalFormatErrors = process.env.FORMAT_WRANGLER_ERRORS;
|
|
777
|
+
process.env.FORMAT_WRANGLER_ERRORS = "true";
|
|
778
|
+
|
|
779
|
+
const worker = await unstable_dev("index.js", {
|
|
780
|
+
experimental: {
|
|
781
|
+
disableExperimentalWarning: true,
|
|
782
|
+
disableDevRegistry: true,
|
|
783
|
+
testScheduled: true,
|
|
784
|
+
d1Databases: [
|
|
785
|
+
{
|
|
786
|
+
binding: "DB",
|
|
787
|
+
database_name: "db",
|
|
788
|
+
database_id: "00000000-0000-0000-0000-000000000000",
|
|
789
|
+
},
|
|
790
|
+
],
|
|
791
|
+
},
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
try {
|
|
795
|
+
let res = await worker.fetch("http://localhost/setup");
|
|
796
|
+
expect(res.status).toBe(204);
|
|
797
|
+
|
|
798
|
+
res = await worker.fetch("http://localhost/__scheduled");
|
|
799
|
+
expect(res.status).toBe(200);
|
|
800
|
+
expect(await res.text()).toBe("Ran scheduled event");
|
|
801
|
+
|
|
802
|
+
res = await worker.fetch("http://localhost/query");
|
|
803
|
+
expect(res.status).toBe(200);
|
|
804
|
+
expect(await res.json()).toEqual([{ id: 1, value: "one" }]);
|
|
805
|
+
|
|
806
|
+
res = await worker.fetch("http://localhost/bad");
|
|
807
|
+
expect(res.status).toBe(500);
|
|
808
|
+
expect(res.headers.get("Content-Type")).toBe("text/html");
|
|
809
|
+
expect(await res.text()).toContain("Error: Not found!");
|
|
810
|
+
} finally {
|
|
811
|
+
process.env.FORMAT_WRANGLER_ERRORS = originalFormatErrors;
|
|
812
|
+
await worker.stop();
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
});
|