wrangler 0.0.0-e178d6fb → 0.0.0-e1c2f5b9

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.
Files changed (239) hide show
  1. package/README.md +16 -2
  2. package/bin/wrangler.js +31 -11
  3. package/miniflare-dist/index.mjs +1340 -330
  4. package/package.json +40 -13
  5. package/src/__tests__/access.test.ts +25 -0
  6. package/src/__tests__/api-dev.test.ts +238 -0
  7. package/src/__tests__/api-devregistry.test.js +64 -0
  8. package/src/__tests__/api.test.ts +80 -0
  9. package/src/__tests__/configuration.test.ts +683 -470
  10. package/src/__tests__/d1.test.ts +123 -0
  11. package/src/__tests__/delete.test.ts +263 -0
  12. package/src/__tests__/deployments.test.ts +105 -0
  13. package/src/__tests__/dev.test.tsx +453 -70
  14. package/src/__tests__/dialogs.test.tsx +40 -0
  15. package/src/__tests__/generate.test.ts +235 -0
  16. package/src/__tests__/get-host-from-url.test.ts +16 -0
  17. package/src/__tests__/helpers/mock-auth-domain.ts +20 -0
  18. package/src/__tests__/helpers/mock-cfetch.ts +92 -26
  19. package/src/__tests__/helpers/mock-console.ts +11 -2
  20. package/src/__tests__/helpers/mock-dialogs.ts +1 -1
  21. package/src/__tests__/helpers/mock-get-zone-from-host.ts +8 -0
  22. package/src/__tests__/helpers/mock-known-routes.ts +7 -0
  23. package/src/__tests__/helpers/mock-kv.ts +1 -1
  24. package/src/__tests__/helpers/mock-oauth-flow.ts +74 -53
  25. package/src/__tests__/helpers/mock-process.ts +8 -13
  26. package/src/__tests__/helpers/msw/handlers/access.ts +13 -0
  27. package/src/__tests__/helpers/msw/handlers/deployments.ts +59 -0
  28. package/src/__tests__/helpers/msw/handlers/namespaces.ts +104 -0
  29. package/src/__tests__/helpers/msw/handlers/oauth.ts +31 -0
  30. package/src/__tests__/helpers/msw/handlers/r2.ts +80 -0
  31. package/src/__tests__/helpers/msw/handlers/script.ts +75 -0
  32. package/src/__tests__/helpers/msw/handlers/user.ts +63 -0
  33. package/src/__tests__/helpers/msw/handlers/zones.ts +22 -0
  34. package/src/__tests__/helpers/msw/index.ts +21 -0
  35. package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +1 -0
  36. package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +5 -0
  37. package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +1 -0
  38. package/src/__tests__/helpers/worker-scripts/parent-worker.js +8 -0
  39. package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +5 -0
  40. package/src/__tests__/index.test.ts +103 -97
  41. package/src/__tests__/init.test.ts +1484 -382
  42. package/src/__tests__/jest.setup.ts +88 -5
  43. package/src/__tests__/kv.test.ts +655 -540
  44. package/src/__tests__/logout.test.ts +47 -0
  45. package/src/__tests__/metrics.test.ts +95 -45
  46. package/src/__tests__/middleware.scheduled.test.ts +145 -0
  47. package/src/__tests__/middleware.test.ts +750 -0
  48. package/src/__tests__/pages-deployment-tail.test.ts +884 -0
  49. package/src/__tests__/pages.test.ts +1301 -119
  50. package/src/__tests__/paths.test.ts +39 -0
  51. package/src/__tests__/publish.test.ts +2266 -1180
  52. package/src/__tests__/pubsub.test.ts +211 -88
  53. package/src/__tests__/queues.test.ts +522 -0
  54. package/src/__tests__/r2.test.ts +363 -203
  55. package/src/__tests__/secret.test.ts +261 -59
  56. package/src/__tests__/tail.test.ts +352 -151
  57. package/src/__tests__/test-old-node-version.js +3 -3
  58. package/src/__tests__/tsconfig-sanity.ts +12 -0
  59. package/src/__tests__/tsconfig.json +8 -0
  60. package/src/__tests__/tsconfig.tsbuildinfo +1 -0
  61. package/src/__tests__/type-generation.test.ts +233 -0
  62. package/src/__tests__/user.test.ts +59 -73
  63. package/src/__tests__/utils-collectKeyValues.test.ts +47 -0
  64. package/src/__tests__/validate-dev-props.test.ts +56 -0
  65. package/src/__tests__/whoami.test.tsx +114 -66
  66. package/src/__tests__/worker-namespace.test.ts +154 -155
  67. package/src/api/dev.ts +170 -38
  68. package/src/api/index.ts +1 -0
  69. package/src/bundle-reporter.tsx +41 -2
  70. package/src/bundle.ts +668 -81
  71. package/src/cfetch/index.ts +40 -3
  72. package/src/cfetch/internal.ts +144 -32
  73. package/src/cli.ts +4 -3
  74. package/src/config/config.ts +27 -3
  75. package/src/config/environment.ts +131 -7
  76. package/src/config/index.ts +128 -8
  77. package/src/config/validation-helpers.ts +19 -6
  78. package/src/config/validation.ts +411 -14
  79. package/src/config-cache.ts +3 -2
  80. package/src/create-worker-preview.ts +31 -6
  81. package/src/create-worker-upload-form.ts +84 -22
  82. package/src/d1/backups.tsx +223 -0
  83. package/src/d1/constants.ts +2 -0
  84. package/src/d1/create.tsx +63 -0
  85. package/src/d1/delete.tsx +56 -0
  86. package/src/d1/execute.tsx +352 -0
  87. package/src/d1/formatTimeAgo.ts +14 -0
  88. package/src/d1/index.ts +101 -0
  89. package/src/d1/list.tsx +48 -0
  90. package/src/d1/migrations/apply.tsx +196 -0
  91. package/src/d1/migrations/create.tsx +77 -0
  92. package/src/d1/migrations/helpers.ts +147 -0
  93. package/src/d1/migrations/index.tsx +3 -0
  94. package/src/d1/migrations/list.tsx +79 -0
  95. package/src/d1/migrations/options.ts +18 -0
  96. package/src/d1/options.ts +22 -0
  97. package/src/d1/types.tsx +24 -0
  98. package/src/d1/utils.ts +48 -0
  99. package/src/delete.ts +108 -0
  100. package/src/deployments.ts +83 -0
  101. package/src/deprecated/index.ts +145 -0
  102. package/src/dev/dev-vars.ts +11 -8
  103. package/src/dev/dev.tsx +220 -58
  104. package/src/dev/get-local-persistence-path.tsx +31 -0
  105. package/src/dev/local.tsx +740 -181
  106. package/src/dev/remote.tsx +340 -123
  107. package/src/dev/start-server.ts +543 -0
  108. package/src/dev/use-esbuild.ts +61 -7
  109. package/src/dev/validate-dev-props.ts +31 -0
  110. package/src/dev-registry.tsx +201 -0
  111. package/src/dev.tsx +614 -258
  112. package/src/dialogs.tsx +41 -8
  113. package/src/{worker-namespace.ts → dispatch-namespace.ts} +23 -22
  114. package/src/docs/index.ts +97 -0
  115. package/src/entry.ts +3 -2
  116. package/src/environment-variables/factory.ts +88 -0
  117. package/src/environment-variables/misc-variables.ts +30 -0
  118. package/src/generate/index.ts +300 -0
  119. package/src/git-client.ts +100 -7
  120. package/src/index.tsx +249 -1560
  121. package/src/init.ts +626 -150
  122. package/src/inspect.ts +137 -32
  123. package/src/{metrics/is-ci.ts → is-ci.ts} +0 -0
  124. package/src/is-interactive.ts +4 -0
  125. package/src/jest.d.ts +4 -0
  126. package/src/{kv.ts → kv/helpers.ts} +3 -3
  127. package/src/kv/index.ts +596 -0
  128. package/src/logger.ts +27 -8
  129. package/src/metrics/index.ts +1 -0
  130. package/src/metrics/metrics-config.ts +4 -4
  131. package/src/metrics/metrics-dispatcher.ts +1 -0
  132. package/src/metrics/metrics-usage-headers.ts +24 -0
  133. package/src/metrics/send-event.ts +13 -8
  134. package/src/miniflare-cli/assets.ts +172 -465
  135. package/src/miniflare-cli/index.ts +149 -24
  136. package/src/miniflare-cli/tsconfig.json +9 -0
  137. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -0
  138. package/src/miniflare-cli/types.ts +11 -0
  139. package/src/module-collection.ts +12 -3
  140. package/src/pages/build.tsx +108 -42
  141. package/src/pages/constants.ts +11 -0
  142. package/src/pages/deployment-tails.tsx +284 -0
  143. package/src/pages/deployments.tsx +9 -31
  144. package/src/pages/dev.tsx +417 -108
  145. package/src/pages/errors.ts +66 -0
  146. package/src/pages/functions/buildPlugin.ts +86 -84
  147. package/src/pages/functions/buildWorker.ts +121 -106
  148. package/src/pages/functions/routes-consolidation.test.ts +250 -0
  149. package/src/pages/functions/routes-consolidation.ts +73 -0
  150. package/src/pages/functions/routes-transformation.test.ts +282 -0
  151. package/src/pages/functions/routes-transformation.ts +115 -0
  152. package/src/pages/functions/routes-validation.test.ts +403 -0
  153. package/src/pages/functions/routes-validation.ts +202 -0
  154. package/src/pages/functions/tsconfig.json +8 -0
  155. package/src/pages/functions/tsconfig.tsbuildinfo +1 -0
  156. package/src/pages/functions.tsx +82 -0
  157. package/src/pages/hash.tsx +13 -0
  158. package/src/pages/index.tsx +73 -55
  159. package/src/pages/projects.tsx +9 -3
  160. package/src/pages/prompt-select-project.tsx +31 -0
  161. package/src/pages/publish.tsx +183 -60
  162. package/src/pages/types.ts +1 -0
  163. package/src/pages/upload.tsx +107 -56
  164. package/src/pages/utils.ts +13 -2
  165. package/src/paths.ts +49 -4
  166. package/src/proxy.ts +375 -157
  167. package/src/publish/index.ts +270 -0
  168. package/src/{publish.ts → publish/publish.ts} +431 -188
  169. package/src/pubsub/pubsub-commands.tsx +4 -3
  170. package/src/queues/cli/commands/consumer/add.ts +71 -0
  171. package/src/queues/cli/commands/consumer/index.ts +22 -0
  172. package/src/queues/cli/commands/consumer/remove.ts +38 -0
  173. package/src/queues/cli/commands/create.ts +25 -0
  174. package/src/queues/cli/commands/delete.ts +26 -0
  175. package/src/queues/cli/commands/index.ts +36 -0
  176. package/src/queues/cli/commands/list.ts +25 -0
  177. package/src/queues/client.ts +135 -0
  178. package/src/queues/utils.ts +18 -0
  179. package/src/r2/constants.ts +4 -0
  180. package/src/r2/helpers.ts +131 -0
  181. package/src/r2/index.ts +289 -0
  182. package/src/routes.ts +140 -0
  183. package/src/secret/index.ts +379 -0
  184. package/src/sites.tsx +3 -3
  185. package/src/tail/createTail.ts +379 -0
  186. package/src/tail/filters.ts +4 -6
  187. package/src/tail/index.ts +199 -284
  188. package/src/tail/printing.ts +43 -3
  189. package/src/tsconfig-sanity.ts +16 -0
  190. package/src/type-generation.ts +181 -0
  191. package/src/user/access.ts +68 -0
  192. package/src/user/auth-variables.ts +113 -0
  193. package/src/user/choose-account.tsx +1 -1
  194. package/src/user/index.ts +0 -1
  195. package/src/user/user.tsx +116 -49
  196. package/src/utils/collectKeyValues.ts +14 -0
  197. package/src/whoami.tsx +80 -2
  198. package/src/worker.ts +69 -9
  199. package/src/yargs-types.ts +24 -0
  200. package/src/zones.ts +124 -9
  201. package/templates/__tests__/pages-dev-util.test.ts +128 -0
  202. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  203. package/templates/__tests__/tsconfig.json +8 -0
  204. package/templates/__tests__/tsconfig.tsbuildinfo +1 -0
  205. package/templates/d1-beta-facade.js +205 -0
  206. package/templates/facade.d.ts +14 -0
  207. package/templates/first-party-worker-module-facade.ts +19 -0
  208. package/templates/format-dev-errors.ts +33 -0
  209. package/templates/init-tests/test-jest-new-worker.js +23 -0
  210. package/templates/init-tests/test-vitest-new-worker.js +24 -0
  211. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  212. package/templates/middleware/common.ts +62 -0
  213. package/templates/middleware/loader-modules.ts +82 -0
  214. package/templates/middleware/loader-sw.ts +233 -0
  215. package/templates/middleware/middleware-miniflare3-json-error.ts +20 -0
  216. package/templates/middleware/middleware-pretty-error.ts +40 -0
  217. package/templates/middleware/middleware-scheduled.ts +15 -0
  218. package/templates/new-worker.js +1 -1
  219. package/templates/pages-dev-pipeline.ts +31 -0
  220. package/templates/pages-dev-util.ts +52 -0
  221. package/templates/pages-shim.ts +4 -1
  222. package/templates/pages-template-plugin.ts +21 -5
  223. package/templates/pages-template-worker.ts +37 -9
  224. package/templates/{static-asset-facade.js → serve-static-assets.ts} +23 -7
  225. package/templates/service-bindings-module-facade.js +54 -0
  226. package/templates/service-bindings-sw-facade.js +42 -0
  227. package/templates/tsconfig-sanity.ts +11 -0
  228. package/templates/tsconfig.init.json +106 -0
  229. package/templates/tsconfig.json +5 -102
  230. package/templates/tsconfig.tsbuildinfo +1 -0
  231. package/wrangler-dist/cli.d.ts +621 -42
  232. package/wrangler-dist/cli.js +144441 -102606
  233. package/src/environment-variables.ts +0 -35
  234. package/src/faye-websocket.d.ts +0 -6
  235. package/src/generate.ts +0 -33
  236. package/src/miniflare-cli/enum-keys.ts +0 -17
  237. package/src/preview.ts +0 -31
  238. package/src/r2.ts +0 -50
  239. package/src/user/env-vars.ts +0 -46
@@ -25,8 +25,9 @@ describe("normalizeAndValidateConfig()", () => {
25
25
  compatibility_date: undefined,
26
26
  compatibility_flags: [],
27
27
  configPath: undefined,
28
+ d1_databases: [],
28
29
  dev: {
29
- ip: "localhost",
30
+ ip: "0.0.0.0",
30
31
  local_protocol: "http",
31
32
  port: undefined, // the default of 8787 is set at runtime
32
33
  upstream_protocol: "https",
@@ -40,12 +41,21 @@ describe("normalizeAndValidateConfig()", () => {
40
41
  tsconfig: undefined,
41
42
  kv_namespaces: [],
42
43
  legacy_env: true,
44
+ logfwdr: {
45
+ bindings: [],
46
+ schema: undefined,
47
+ },
43
48
  send_metrics: undefined,
44
49
  main: undefined,
45
50
  migrations: [],
46
51
  name: undefined,
52
+ queues: {
53
+ consumers: [],
54
+ producers: [],
55
+ },
47
56
  r2_buckets: [],
48
57
  services: [],
58
+ analytics_engine_datasets: [],
49
59
  route: undefined,
50
60
  routes: undefined,
51
61
  rules: [],
@@ -57,7 +67,7 @@ describe("normalizeAndValidateConfig()", () => {
57
67
  unsafe: {
58
68
  bindings: [],
59
69
  },
60
- worker_namespaces: [],
70
+ dispatch_namespaces: [],
61
71
  usage_model: undefined,
62
72
  vars: {},
63
73
  define: {},
@@ -68,6 +78,9 @@ describe("normalizeAndValidateConfig()", () => {
68
78
  no_bundle: undefined,
69
79
  minify: undefined,
70
80
  node_compat: undefined,
81
+ first_party_worker: undefined,
82
+ keep_vars: undefined,
83
+ logpush: undefined,
71
84
  });
72
85
  expect(diagnostics.hasErrors()).toBe(false);
73
86
  expect(diagnostics.hasWarnings()).toBe(false);
@@ -101,6 +114,7 @@ describe("normalizeAndValidateConfig()", () => {
101
114
  const expectedConfig = {
102
115
  legacy_env: "FOO",
103
116
  send_metrics: "BAD",
117
+ keep_vars: "NEVER",
104
118
  dev: {
105
119
  ip: 222,
106
120
  port: "FOO",
@@ -123,6 +137,7 @@ describe("normalizeAndValidateConfig()", () => {
123
137
  "Processing wrangler configuration:
124
138
  - Expected \\"legacy_env\\" to be of type boolean but got \\"FOO\\".
125
139
  - Expected \\"send_metrics\\" to be of type boolean but got \\"BAD\\".
140
+ - Expected \\"keep_vars\\" to be of type boolean but got \\"NEVER\\".
126
141
  - Expected \\"dev.ip\\" to be of type string but got 222.
127
142
  - Expected \\"dev.port\\" to be of type number but got \\"FOO\\".
128
143
  - Expected \\"dev.local_protocol\\" field to be one of [\\"http\\",\\"https\\"] but got \\"wss\\".
@@ -463,6 +478,56 @@ describe("normalizeAndValidateConfig()", () => {
463
478
  });
464
479
 
465
480
  describe("[assets]", () => {
481
+ it("normalizes a string input to an object", () => {
482
+ const { config, diagnostics } = normalizeAndValidateConfig(
483
+ {
484
+ assets: "path/to/assets",
485
+ } as unknown as RawConfig,
486
+ undefined,
487
+ { env: undefined }
488
+ );
489
+
490
+ expect(config.assets).toMatchInlineSnapshot(`
491
+ Object {
492
+ "browser_TTL": undefined,
493
+ "bucket": "path/to/assets",
494
+ "exclude": Array [],
495
+ "include": Array [],
496
+ "serve_single_page_app": false,
497
+ }
498
+ `);
499
+ expect(diagnostics.hasWarnings()).toBe(true);
500
+ expect(diagnostics.hasErrors()).toBe(false);
501
+
502
+ expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
503
+ "Processing wrangler configuration:
504
+ - \\"assets\\" fields are experimental and may change or break at any time."
505
+ `);
506
+ });
507
+
508
+ it("errors when input is not a string or object", () => {
509
+ const { config, diagnostics } = normalizeAndValidateConfig(
510
+ {
511
+ assets: 123,
512
+ } as unknown as RawConfig,
513
+ undefined,
514
+ { env: undefined }
515
+ );
516
+
517
+ expect(config.assets).toBeUndefined();
518
+ expect(diagnostics.hasWarnings()).toBe(true);
519
+ expect(diagnostics.hasErrors()).toBe(true);
520
+
521
+ expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
522
+ "Processing wrangler configuration:
523
+ - \\"assets\\" fields are experimental and may change or break at any time."
524
+ `);
525
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
526
+ "Processing wrangler configuration:
527
+ - Expected the \`assets\` field to be a string or an object, but got number."
528
+ `);
529
+ });
530
+
466
531
  it("should error if `assets` config is missing `bucket`", () => {
467
532
  const expectedConfig: RawConfig = {
468
533
  // @ts-expect-error we're intentionally passing an invalid configuration here
@@ -478,7 +543,9 @@ describe("normalizeAndValidateConfig()", () => {
478
543
  { env: undefined }
479
544
  );
480
545
 
481
- expect(config).toEqual(expect.objectContaining(expectedConfig));
546
+ expect(config.assets).toEqual(
547
+ expect.objectContaining(expectedConfig.assets)
548
+ );
482
549
  expect(diagnostics.hasWarnings()).toBe(true);
483
550
  expect(diagnostics.hasErrors()).toBe(true);
484
551
 
@@ -498,6 +565,8 @@ describe("normalizeAndValidateConfig()", () => {
498
565
  bucket: "BUCKET",
499
566
  include: [222, 333],
500
567
  exclude: [444, 555],
568
+ browser_TTL: "not valid",
569
+ serve_single_page_app: "INVALID",
501
570
  },
502
571
  };
503
572
 
@@ -514,12 +583,14 @@ describe("normalizeAndValidateConfig()", () => {
514
583
  - \\"assets\\" fields are experimental and may change or break at any time."
515
584
  `);
516
585
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
517
- "Processing wrangler configuration:
518
- - Expected \\"assets.include.[0]\\" to be of type string but got 222.
519
- - Expected \\"assets.include.[1]\\" to be of type string but got 333.
520
- - Expected \\"assets.exclude.[0]\\" to be of type string but got 444.
521
- - Expected \\"assets.exclude.[1]\\" to be of type string but got 555."
522
- `);
586
+ "Processing wrangler configuration:
587
+ - Expected \\"assets.include.[0]\\" to be of type string but got 222.
588
+ - Expected \\"assets.include.[1]\\" to be of type string but got 333.
589
+ - Expected \\"assets.exclude.[0]\\" to be of type string but got 444.
590
+ - Expected \\"assets.exclude.[1]\\" to be of type string but got 555.
591
+ - Expected \\"assets.browser_TTL\\" to be of type number but got \\"not valid\\".
592
+ - Expected \\"assets.serve_single_page_app\\" to be of type boolean but got \\"INVALID\\"."
593
+ `);
523
594
  });
524
595
  });
525
596
 
@@ -845,6 +916,15 @@ describe("normalizeAndValidateConfig()", () => {
845
916
  environment: "SERVICE_BINDING_ENVIRONMENT_1",
846
917
  },
847
918
  ],
919
+ analytics_engine_datasets: [
920
+ {
921
+ binding: "AE_BINDING_1",
922
+ dataset: "DATASET_1",
923
+ },
924
+ {
925
+ binding: "AE_BINDING_2",
926
+ },
927
+ ],
848
928
  unsafe: {
849
929
  bindings: [
850
930
  { name: "UNSAFE_BINDING_1", type: "UNSAFE_TYPE_1" },
@@ -858,6 +938,8 @@ describe("normalizeAndValidateConfig()", () => {
858
938
  no_bundle: true,
859
939
  minify: true,
860
940
  node_compat: true,
941
+ first_party_worker: true,
942
+ logpush: true,
861
943
  };
862
944
 
863
945
  const { config, diagnostics } = normalizeAndValidateConfig(
@@ -931,6 +1013,8 @@ describe("normalizeAndValidateConfig()", () => {
931
1013
  no_bundle: "INVALID",
932
1014
  minify: "INVALID",
933
1015
  node_compat: "INVALID",
1016
+ first_party_worker: "INVALID",
1017
+ logpush: "INVALID",
934
1018
  } as unknown as RawEnvironment;
935
1019
 
936
1020
  const { config, diagnostics } = normalizeAndValidateConfig(
@@ -997,7 +1081,9 @@ describe("normalizeAndValidateConfig()", () => {
997
1081
  - The field \\"define.DEF1\\" should be a string but got 1777.
998
1082
  - Expected \\"no_bundle\\" to be of type boolean but got \\"INVALID\\".
999
1083
  - Expected \\"minify\\" to be of type boolean but got \\"INVALID\\".
1000
- - Expected \\"node_compat\\" to be of type boolean but got \\"INVALID\\"."
1084
+ - Expected \\"node_compat\\" to be of type boolean but got \\"INVALID\\".
1085
+ - Expected \\"first_party_worker\\" to be of type boolean but got \\"INVALID\\".
1086
+ - Expected \\"logpush\\" to be of type boolean but got \\"INVALID\\"."
1001
1087
  `);
1002
1088
  });
1003
1089
 
@@ -1249,15 +1335,12 @@ describe("normalizeAndValidateConfig()", () => {
1249
1335
 
1250
1336
  describe("[durable_objects]", () => {
1251
1337
  it("should error if durable_objects is an array", () => {
1252
- const { config, diagnostics } = normalizeAndValidateConfig(
1338
+ const { diagnostics } = normalizeAndValidateConfig(
1253
1339
  { durable_objects: [] } as unknown as RawConfig,
1254
1340
  undefined,
1255
1341
  { env: undefined }
1256
1342
  );
1257
1343
 
1258
- expect(config).toEqual(
1259
- expect.not.objectContaining({ durable_objects: expect.anything })
1260
- );
1261
1344
  expect(diagnostics.hasWarnings()).toBe(false);
1262
1345
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1263
1346
  "Processing wrangler configuration:
@@ -1266,15 +1349,12 @@ describe("normalizeAndValidateConfig()", () => {
1266
1349
  });
1267
1350
 
1268
1351
  it("should error if durable_objects is a string", () => {
1269
- const { config, diagnostics } = normalizeAndValidateConfig(
1352
+ const { diagnostics } = normalizeAndValidateConfig(
1270
1353
  { durable_objects: "BAD" } as unknown as RawConfig,
1271
1354
  undefined,
1272
1355
  { env: undefined }
1273
1356
  );
1274
1357
 
1275
- expect(config).toEqual(
1276
- expect.not.objectContaining({ durable_objects: expect.anything })
1277
- );
1278
1358
  expect(diagnostics.hasWarnings()).toBe(false);
1279
1359
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1280
1360
  "Processing wrangler configuration:
@@ -1283,15 +1363,12 @@ describe("normalizeAndValidateConfig()", () => {
1283
1363
  });
1284
1364
 
1285
1365
  it("should error if durable_objects is a number", () => {
1286
- const { config, diagnostics } = normalizeAndValidateConfig(
1366
+ const { diagnostics } = normalizeAndValidateConfig(
1287
1367
  { durable_objects: 999 } as unknown as RawConfig,
1288
1368
  undefined,
1289
1369
  { env: undefined }
1290
1370
  );
1291
1371
 
1292
- expect(config).toEqual(
1293
- expect.not.objectContaining({ durable_objects: expect.anything })
1294
- );
1295
1372
  expect(diagnostics.hasWarnings()).toBe(false);
1296
1373
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1297
1374
  "Processing wrangler configuration:
@@ -1300,15 +1377,12 @@ describe("normalizeAndValidateConfig()", () => {
1300
1377
  });
1301
1378
 
1302
1379
  it("should error if durable_objects is null", () => {
1303
- const { config, diagnostics } = normalizeAndValidateConfig(
1380
+ const { diagnostics } = normalizeAndValidateConfig(
1304
1381
  { durable_objects: null } as unknown as RawConfig,
1305
1382
  undefined,
1306
1383
  { env: undefined }
1307
1384
  );
1308
1385
 
1309
- expect(config).toEqual(
1310
- expect.not.objectContaining({ durable_objects: expect.anything })
1311
- );
1312
1386
  expect(diagnostics.hasWarnings()).toBe(false);
1313
1387
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1314
1388
  "Processing wrangler configuration:
@@ -1317,15 +1391,12 @@ describe("normalizeAndValidateConfig()", () => {
1317
1391
  });
1318
1392
 
1319
1393
  it("should error if durable_objects.bindings is not defined", () => {
1320
- const { config, diagnostics } = normalizeAndValidateConfig(
1394
+ const { diagnostics } = normalizeAndValidateConfig(
1321
1395
  { durable_objects: {} } as unknown as RawConfig,
1322
1396
  undefined,
1323
1397
  { env: undefined }
1324
1398
  );
1325
1399
 
1326
- expect(config).toEqual(
1327
- expect.not.objectContaining({ durable_objects: expect.anything })
1328
- );
1329
1400
  expect(diagnostics.hasWarnings()).toBe(false);
1330
1401
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1331
1402
  "Processing wrangler configuration:
@@ -1334,17 +1405,12 @@ describe("normalizeAndValidateConfig()", () => {
1334
1405
  });
1335
1406
 
1336
1407
  it("should error if durable_objects.bindings is an object", () => {
1337
- const { config, diagnostics } = normalizeAndValidateConfig(
1408
+ const { diagnostics } = normalizeAndValidateConfig(
1338
1409
  { durable_objects: { bindings: {} } } as unknown as RawConfig,
1339
1410
  undefined,
1340
1411
  { env: undefined }
1341
1412
  );
1342
1413
 
1343
- expect(config).toEqual(
1344
- expect.not.objectContaining({
1345
- durable_objects: { bindings: expect.anything },
1346
- })
1347
- );
1348
1414
  expect(diagnostics.hasWarnings()).toBe(false);
1349
1415
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1350
1416
  "Processing wrangler configuration:
@@ -1353,17 +1419,12 @@ describe("normalizeAndValidateConfig()", () => {
1353
1419
  });
1354
1420
 
1355
1421
  it("should error if durable_objects.bindings is a string", () => {
1356
- const { config, diagnostics } = normalizeAndValidateConfig(
1422
+ const { diagnostics } = normalizeAndValidateConfig(
1357
1423
  { durable_objects: { bindings: "BAD" } } as unknown as RawConfig,
1358
1424
  undefined,
1359
1425
  { env: undefined }
1360
1426
  );
1361
1427
 
1362
- expect(config).toEqual(
1363
- expect.not.objectContaining({
1364
- durable_objects: { bindings: expect.anything },
1365
- })
1366
- );
1367
1428
  expect(diagnostics.hasWarnings()).toBe(false);
1368
1429
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1369
1430
  "Processing wrangler configuration:
@@ -1372,17 +1433,12 @@ describe("normalizeAndValidateConfig()", () => {
1372
1433
  });
1373
1434
 
1374
1435
  it("should error if durable_objects.bindings is a number", () => {
1375
- const { config, diagnostics } = normalizeAndValidateConfig(
1436
+ const { diagnostics } = normalizeAndValidateConfig(
1376
1437
  { durable_objects: { bindings: 999 } } as unknown as RawConfig,
1377
1438
  undefined,
1378
1439
  { env: undefined }
1379
1440
  );
1380
1441
 
1381
- expect(config).toEqual(
1382
- expect.not.objectContaining({
1383
- durable_objects: { bindings: expect.anything },
1384
- })
1385
- );
1386
1442
  expect(diagnostics.hasWarnings()).toBe(false);
1387
1443
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1388
1444
  "Processing wrangler configuration:
@@ -1391,17 +1447,12 @@ describe("normalizeAndValidateConfig()", () => {
1391
1447
  });
1392
1448
 
1393
1449
  it("should error if durable_objects.bindings is null", () => {
1394
- const { config, diagnostics } = normalizeAndValidateConfig(
1450
+ const { diagnostics } = normalizeAndValidateConfig(
1395
1451
  { durable_objects: { bindings: null } } as unknown as RawConfig,
1396
1452
  undefined,
1397
1453
  { env: undefined }
1398
1454
  );
1399
1455
 
1400
- expect(config).toEqual(
1401
- expect.not.objectContaining({
1402
- durable_objects: { bindings: expect.anything },
1403
- })
1404
- );
1405
1456
  expect(diagnostics.hasWarnings()).toBe(false);
1406
1457
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1407
1458
  "Processing wrangler configuration:
@@ -1410,7 +1461,7 @@ describe("normalizeAndValidateConfig()", () => {
1410
1461
  });
1411
1462
 
1412
1463
  it("should error if durable_objects.bindings are not valid", () => {
1413
- const { config, diagnostics } = normalizeAndValidateConfig(
1464
+ const { diagnostics } = normalizeAndValidateConfig(
1414
1465
  {
1415
1466
  durable_objects: {
1416
1467
  bindings: [
@@ -1445,11 +1496,6 @@ describe("normalizeAndValidateConfig()", () => {
1445
1496
  { env: undefined }
1446
1497
  );
1447
1498
 
1448
- expect(config).toEqual(
1449
- expect.not.objectContaining({
1450
- durable_objects: { bindings: expect.anything },
1451
- })
1452
- );
1453
1499
  expect(diagnostics.hasWarnings()).toBe(false);
1454
1500
 
1455
1501
  expect(diagnostics.hasErrors()).toBe(true);
@@ -1492,15 +1538,12 @@ describe("normalizeAndValidateConfig()", () => {
1492
1538
 
1493
1539
  describe("[kv_namespaces]", () => {
1494
1540
  it("should error if kv_namespaces is an object", () => {
1495
- const { config, diagnostics } = normalizeAndValidateConfig(
1541
+ const { diagnostics } = normalizeAndValidateConfig(
1496
1542
  { kv_namespaces: {} } as unknown as RawConfig,
1497
1543
  undefined,
1498
1544
  { env: undefined }
1499
1545
  );
1500
1546
 
1501
- expect(config).toEqual(
1502
- expect.not.objectContaining({ kv_namespaces: expect.anything })
1503
- );
1504
1547
  expect(diagnostics.hasWarnings()).toBe(false);
1505
1548
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1506
1549
  "Processing wrangler configuration:
@@ -1509,15 +1552,12 @@ describe("normalizeAndValidateConfig()", () => {
1509
1552
  });
1510
1553
 
1511
1554
  it("should error if kv_namespaces is a string", () => {
1512
- const { config, diagnostics } = normalizeAndValidateConfig(
1555
+ const { diagnostics } = normalizeAndValidateConfig(
1513
1556
  { kv_namespaces: "BAD" } as unknown as RawConfig,
1514
1557
  undefined,
1515
1558
  { env: undefined }
1516
1559
  );
1517
1560
 
1518
- expect(config).toEqual(
1519
- expect.not.objectContaining({ kv_namespaces: expect.anything })
1520
- );
1521
1561
  expect(diagnostics.hasWarnings()).toBe(false);
1522
1562
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1523
1563
  "Processing wrangler configuration:
@@ -1526,15 +1566,12 @@ describe("normalizeAndValidateConfig()", () => {
1526
1566
  });
1527
1567
 
1528
1568
  it("should error if kv_namespaces is a number", () => {
1529
- const { config, diagnostics } = normalizeAndValidateConfig(
1569
+ const { diagnostics } = normalizeAndValidateConfig(
1530
1570
  { kv_namespaces: 999 } as unknown as RawConfig,
1531
1571
  undefined,
1532
1572
  { env: undefined }
1533
1573
  );
1534
1574
 
1535
- expect(config).toEqual(
1536
- expect.not.objectContaining({ kv_namespaces: expect.anything })
1537
- );
1538
1575
  expect(diagnostics.hasWarnings()).toBe(false);
1539
1576
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1540
1577
  "Processing wrangler configuration:
@@ -1543,15 +1580,12 @@ describe("normalizeAndValidateConfig()", () => {
1543
1580
  });
1544
1581
 
1545
1582
  it("should error if kv_namespaces is null", () => {
1546
- const { config, diagnostics } = normalizeAndValidateConfig(
1583
+ const { diagnostics } = normalizeAndValidateConfig(
1547
1584
  { kv_namespaces: null } as unknown as RawConfig,
1548
1585
  undefined,
1549
1586
  { env: undefined }
1550
1587
  );
1551
1588
 
1552
- expect(config).toEqual(
1553
- expect.not.objectContaining({ kv_namespaces: expect.anything })
1554
- );
1555
1589
  expect(diagnostics.hasWarnings()).toBe(false);
1556
1590
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1557
1591
  "Processing wrangler configuration:
@@ -1560,7 +1594,7 @@ describe("normalizeAndValidateConfig()", () => {
1560
1594
  });
1561
1595
 
1562
1596
  it("should error if kv_namespaces.bindings are not valid", () => {
1563
- const { config, diagnostics } = normalizeAndValidateConfig(
1597
+ const { diagnostics } = normalizeAndValidateConfig(
1564
1598
  {
1565
1599
  kv_namespaces: [
1566
1600
  {},
@@ -1571,17 +1605,13 @@ describe("normalizeAndValidateConfig()", () => {
1571
1605
  id: "KV_ID_2",
1572
1606
  preview_id: 2222,
1573
1607
  },
1608
+ { binding: "VALID", id: "" },
1574
1609
  ],
1575
1610
  } as unknown as RawConfig,
1576
1611
  undefined,
1577
1612
  { env: undefined }
1578
1613
  );
1579
1614
 
1580
- expect(config).toEqual(
1581
- expect.not.objectContaining({
1582
- kv_namespaces: { bindings: expect.anything },
1583
- })
1584
- );
1585
1615
  expect(diagnostics.hasWarnings()).toBe(false);
1586
1616
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1587
1617
  "Processing wrangler configuration:
@@ -1590,213 +1620,381 @@ describe("normalizeAndValidateConfig()", () => {
1590
1620
  - \\"kv_namespaces[1]\\" bindings should have a string \\"id\\" field but got {\\"binding\\":\\"VALID\\"}.
1591
1621
  - \\"kv_namespaces[2]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2000,\\"id\\":2111}.
1592
1622
  - \\"kv_namespaces[2]\\" bindings should have a string \\"id\\" field but got {\\"binding\\":2000,\\"id\\":2111}.
1593
- - \\"kv_namespaces[3]\\" bindings should, optionally, have a string \\"preview_id\\" field but got {\\"binding\\":\\"KV_BINDING_2\\",\\"id\\":\\"KV_ID_2\\",\\"preview_id\\":2222}."
1623
+ - \\"kv_namespaces[3]\\" bindings should, optionally, have a string \\"preview_id\\" field but got {\\"binding\\":\\"KV_BINDING_2\\",\\"id\\":\\"KV_ID_2\\",\\"preview_id\\":2222}.
1624
+ - \\"kv_namespaces[4]\\" bindings should have a string \\"id\\" field but got {\\"binding\\":\\"VALID\\",\\"id\\":\\"\\"}."
1594
1625
  `);
1595
1626
  });
1596
1627
  });
1597
1628
 
1598
- describe("[r2_buckets]", () => {
1599
- it("should error if r2_buckets is an object", () => {
1600
- const { config, diagnostics } = normalizeAndValidateConfig(
1601
- { r2_buckets: {} } as unknown as RawConfig,
1629
+ describe("[d1_databases]", () => {
1630
+ it("should error if d1_databases is an object", () => {
1631
+ const { diagnostics } = normalizeAndValidateConfig(
1632
+ { d1_databases: {} } as unknown as RawConfig,
1602
1633
  undefined,
1603
1634
  { env: undefined }
1604
1635
  );
1605
1636
 
1606
- expect(config).toEqual(
1607
- expect.not.objectContaining({ r2_buckets: expect.anything })
1608
- );
1609
1637
  expect(diagnostics.hasWarnings()).toBe(false);
1610
1638
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1611
1639
  "Processing wrangler configuration:
1612
- - The field \\"r2_buckets\\" should be an array but got {}."
1640
+ - The field \\"d1_databases\\" should be an array but got {}."
1613
1641
  `);
1614
1642
  });
1615
1643
 
1616
- it("should error if r2_buckets is a string", () => {
1617
- const { config, diagnostics } = normalizeAndValidateConfig(
1618
- { r2_buckets: "BAD" } as unknown as RawConfig,
1644
+ it("should error if d1_databases is a string", () => {
1645
+ const { diagnostics } = normalizeAndValidateConfig(
1646
+ { d1_databases: "BAD" } as unknown as RawConfig,
1619
1647
  undefined,
1620
1648
  { env: undefined }
1621
1649
  );
1622
1650
 
1623
- expect(config).toEqual(
1624
- expect.not.objectContaining({ r2_buckets: expect.anything })
1625
- );
1626
1651
  expect(diagnostics.hasWarnings()).toBe(false);
1627
1652
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1628
1653
  "Processing wrangler configuration:
1629
- - The field \\"r2_buckets\\" should be an array but got \\"BAD\\"."
1654
+ - The field \\"d1_databases\\" should be an array but got \\"BAD\\"."
1630
1655
  `);
1631
1656
  });
1632
1657
 
1633
- it("should error if r2_buckets is a number", () => {
1634
- const { config, diagnostics } = normalizeAndValidateConfig(
1635
- { r2_buckets: 999 } as unknown as RawConfig,
1658
+ it("should error if d1_databases is a number", () => {
1659
+ const { diagnostics } = normalizeAndValidateConfig(
1660
+ { d1_databases: 999 } as unknown as RawConfig,
1636
1661
  undefined,
1637
1662
  { env: undefined }
1638
1663
  );
1639
1664
 
1640
- expect(config).toEqual(
1641
- expect.not.objectContaining({ r2_buckets: expect.anything })
1642
- );
1643
1665
  expect(diagnostics.hasWarnings()).toBe(false);
1644
1666
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1645
1667
  "Processing wrangler configuration:
1646
- - The field \\"r2_buckets\\" should be an array but got 999."
1668
+ - The field \\"d1_databases\\" should be an array but got 999."
1647
1669
  `);
1648
1670
  });
1649
1671
 
1650
- it("should error if r2_buckets is null", () => {
1651
- const { config, diagnostics } = normalizeAndValidateConfig(
1652
- { r2_buckets: null } as unknown as RawConfig,
1672
+ it("should error if d1_databases is null", () => {
1673
+ const { diagnostics } = normalizeAndValidateConfig(
1674
+ { d1_databases: null } as unknown as RawConfig,
1653
1675
  undefined,
1654
1676
  { env: undefined }
1655
1677
  );
1656
1678
 
1657
- expect(config).toEqual(
1658
- expect.not.objectContaining({ r2_buckets: expect.anything })
1659
- );
1660
1679
  expect(diagnostics.hasWarnings()).toBe(false);
1661
1680
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1662
1681
  "Processing wrangler configuration:
1663
- - The field \\"r2_buckets\\" should be an array but got null."
1682
+ - The field \\"d1_databases\\" should be an array but got null."
1664
1683
  `);
1665
1684
  });
1666
1685
 
1667
- it("should error if r2_buckets.bindings are not valid", () => {
1668
- const { config, diagnostics } = normalizeAndValidateConfig(
1686
+ it("should error if d1_databases.bindings are not valid", () => {
1687
+ const { diagnostics } = normalizeAndValidateConfig(
1669
1688
  {
1670
- r2_buckets: [
1689
+ d1_databases: [
1671
1690
  {},
1672
- { binding: "R2_BINDING_1" },
1673
- { binding: 2333, bucket_name: 2444 },
1691
+ { binding: "VALID" },
1692
+ { binding: 2000, id: 2111 },
1674
1693
  {
1675
- binding: "R2_BINDING_2",
1676
- bucket_name: "R2_BUCKET_2",
1677
- preview_bucket_name: 2555,
1694
+ binding: "D1_BINDING_2",
1695
+ id: "my-db",
1696
+ preview_id: 2222,
1678
1697
  },
1698
+ { binding: "VALID", id: "" },
1679
1699
  ],
1680
1700
  } as unknown as RawConfig,
1681
1701
  undefined,
1682
1702
  { env: undefined }
1683
1703
  );
1684
1704
 
1685
- expect(config).toEqual(
1686
- expect.not.objectContaining({
1687
- r2_buckets: { bindings: expect.anything },
1688
- })
1689
- );
1690
1705
  expect(diagnostics.hasWarnings()).toBe(false);
1691
1706
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1692
- "Processing wrangler configuration:
1693
- - \\"r2_buckets[0]\\" bindings should have a string \\"binding\\" field but got {}.
1694
- - \\"r2_buckets[0]\\" bindings should have a string \\"bucket_name\\" field but got {}.
1695
- - \\"r2_buckets[1]\\" bindings should have a string \\"bucket_name\\" field but got {\\"binding\\":\\"R2_BINDING_1\\"}.
1696
- - \\"r2_buckets[2]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2333,\\"bucket_name\\":2444}.
1697
- - \\"r2_buckets[2]\\" bindings should have a string \\"bucket_name\\" field but got {\\"binding\\":2333,\\"bucket_name\\":2444}.
1698
- - \\"r2_buckets[3]\\" bindings should, optionally, have a string \\"preview_bucket_name\\" field but got {\\"binding\\":\\"R2_BINDING_2\\",\\"bucket_name\\":\\"R2_BUCKET_2\\",\\"preview_bucket_name\\":2555}."
1699
- `);
1707
+ "Processing wrangler configuration:
1708
+ - \\"d1_databases[0]\\" bindings should have a string \\"binding\\" field but got {}.
1709
+ - \\"d1_databases[0]\\" bindings must have a \\"database_id\\" field but got {}.
1710
+ - \\"d1_databases[1]\\" bindings must have a \\"database_id\\" field but got {\\"binding\\":\\"VALID\\"}.
1711
+ - \\"d1_databases[2]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2000,\\"id\\":2111}.
1712
+ - \\"d1_databases[2]\\" bindings must have a \\"database_id\\" field but got {\\"binding\\":2000,\\"id\\":2111}.
1713
+ - \\"d1_databases[3]\\" bindings must have a \\"database_id\\" field but got {\\"binding\\":\\"D1_BINDING_2\\",\\"id\\":\\"my-db\\",\\"preview_id\\":2222}.
1714
+ - \\"d1_databases[4]\\" bindings must have a \\"database_id\\" field but got {\\"binding\\":\\"VALID\\",\\"id\\":\\"\\"}."
1715
+ `);
1700
1716
  });
1701
1717
  });
1702
1718
 
1703
- describe("[services]", () => {
1704
- it("should error if services is an object", () => {
1719
+ describe("[queues]", () => {
1720
+ it("should error if queues is not an object", () => {
1705
1721
  const { config, diagnostics } = normalizeAndValidateConfig(
1706
- { services: {} } as unknown as RawConfig,
1722
+ { queues: [] } as unknown as RawConfig,
1707
1723
  undefined,
1708
1724
  { env: undefined }
1709
1725
  );
1710
1726
 
1711
1727
  expect(config).toEqual(
1712
- expect.not.objectContaining({ services: expect.anything })
1728
+ expect.not.objectContaining({ queues: expect.anything })
1713
1729
  );
1714
- expect(diagnostics.hasWarnings()).toBe(true);
1715
- expect(diagnostics.hasErrors()).toBe(true);
1716
- expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1717
- "Processing wrangler configuration:
1718
- - \\"services\\" fields are experimental and may change or break at any time."
1719
- `);
1730
+ expect(diagnostics.hasWarnings()).toBe(false);
1720
1731
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1721
- "Processing wrangler configuration:
1722
- - The field \\"services\\" should be an array but got {}."
1723
- `);
1732
+ "Processing wrangler configuration:
1733
+ - The field \\"queues\\" should be an object but got []."
1734
+ `);
1724
1735
  });
1725
1736
 
1726
- it("should error if services is a string", () => {
1737
+ it("should error if queues producer bindings are not valid", () => {
1727
1738
  const { config, diagnostics } = normalizeAndValidateConfig(
1728
- { services: "BAD" } as unknown as RawConfig,
1739
+ {
1740
+ queues: {
1741
+ invalidField: "madeupValue",
1742
+ producers: [
1743
+ {},
1744
+ { binding: "QUEUE_BINDING_1" },
1745
+ { binding: 2333, queue: 2444 },
1746
+ { binding: "QUEUE_BINDING_3", queue: "" },
1747
+ ],
1748
+ },
1749
+ } as unknown as RawConfig,
1729
1750
  undefined,
1730
1751
  { env: undefined }
1731
1752
  );
1732
1753
 
1733
1754
  expect(config).toEqual(
1734
- expect.not.objectContaining({ services: expect.anything })
1755
+ expect.not.objectContaining({
1756
+ queues: { producers: expect.anything },
1757
+ })
1735
1758
  );
1736
1759
  expect(diagnostics.hasWarnings()).toBe(true);
1737
- expect(diagnostics.hasErrors()).toBe(true);
1738
1760
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1739
- "Processing wrangler configuration:
1740
- - \\"services\\" fields are experimental and may change or break at any time."
1741
- `);
1761
+ "Processing wrangler configuration:
1762
+ - Unexpected fields found in queues field: \\"invalidField\\""
1763
+ `);
1764
+
1742
1765
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1743
- "Processing wrangler configuration:
1744
- - The field \\"services\\" should be an array but got \\"BAD\\"."
1745
- `);
1766
+ "Processing wrangler configuration:
1767
+ - \\"queues.producers[0]\\" bindings should have a string \\"binding\\" field but got {}.
1768
+ - \\"queues.producers[0]\\" bindings should have a string \\"queue\\" field but got {}.
1769
+ - \\"queues.producers[1]\\" bindings should have a string \\"queue\\" field but got {\\"binding\\":\\"QUEUE_BINDING_1\\"}.
1770
+ - \\"queues.producers[2]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2333,\\"queue\\":2444}.
1771
+ - \\"queues.producers[2]\\" bindings should have a string \\"queue\\" field but got {\\"binding\\":2333,\\"queue\\":2444}.
1772
+ - \\"queues.producers[3]\\" bindings should have a string \\"queue\\" field but got {\\"binding\\":\\"QUEUE_BINDING_3\\",\\"queue\\":\\"\\"}."
1773
+ `);
1746
1774
  });
1747
1775
 
1748
- it("should error if services is a number", () => {
1776
+ it("should error if queues consumers are not valid", () => {
1749
1777
  const { config, diagnostics } = normalizeAndValidateConfig(
1750
- { services: 999 } as unknown as RawConfig,
1778
+ {
1779
+ queues: {
1780
+ invalidField: "madeupValue",
1781
+ consumers: [
1782
+ {},
1783
+ { queue: 22 },
1784
+ { queue: "myQueue", invalidField: "madeupValue" },
1785
+ {
1786
+ queue: "myQueue",
1787
+ max_batch_size: "3",
1788
+ max_batch_timeout: null,
1789
+ max_retries: "hello",
1790
+ dead_letter_queue: 5,
1791
+ },
1792
+ ],
1793
+ },
1794
+ } as unknown as RawConfig,
1751
1795
  undefined,
1752
1796
  { env: undefined }
1753
1797
  );
1754
1798
 
1755
1799
  expect(config).toEqual(
1756
- expect.not.objectContaining({ services: expect.anything })
1800
+ expect.not.objectContaining({
1801
+ queues: { producers: expect.anything },
1802
+ })
1757
1803
  );
1758
1804
  expect(diagnostics.hasWarnings()).toBe(true);
1759
- expect(diagnostics.hasErrors()).toBe(true);
1760
1805
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1761
- "Processing wrangler configuration:
1762
- - \\"services\\" fields are experimental and may change or break at any time."
1763
- `);
1806
+ "Processing wrangler configuration:
1807
+ - Unexpected fields found in queues field: \\"invalidField\\"
1808
+ - Unexpected fields found in queues.consumers[2] field: \\"invalidField\\""
1809
+ `);
1810
+
1764
1811
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1765
- "Processing wrangler configuration:
1766
- - The field \\"services\\" should be an array but got 999."
1767
- `);
1812
+ "Processing wrangler configuration:
1813
+ - \\"queues.consumers[0]\\" should have a string \\"queue\\" field but got {}.
1814
+ - \\"queues.consumers[1]\\" should have a string \\"queue\\" field but got {\\"queue\\":22}.
1815
+ - \\"queues.consumers[3]\\" should, optionally, have a number \\"max_batch_size\\" field but got {\\"queue\\":\\"myQueue\\",\\"max_batch_size\\":\\"3\\",\\"max_batch_timeout\\":null,\\"max_retries\\":\\"hello\\",\\"dead_letter_queue\\":5}.
1816
+ - \\"queues.consumers[3]\\" should, optionally, have a number \\"max_batch_timeout\\" field but got {\\"queue\\":\\"myQueue\\",\\"max_batch_size\\":\\"3\\",\\"max_batch_timeout\\":null,\\"max_retries\\":\\"hello\\",\\"dead_letter_queue\\":5}.
1817
+ - \\"queues.consumers[3]\\" should, optionally, have a number \\"max_retries\\" field but got {\\"queue\\":\\"myQueue\\",\\"max_batch_size\\":\\"3\\",\\"max_batch_timeout\\":null,\\"max_retries\\":\\"hello\\",\\"dead_letter_queue\\":5}.
1818
+ - \\"queues.consumers[3]\\" should, optionally, have a string \\"dead_letter_queue\\" field but got {\\"queue\\":\\"myQueue\\",\\"max_batch_size\\":\\"3\\",\\"max_batch_timeout\\":null,\\"max_retries\\":\\"hello\\",\\"dead_letter_queue\\":5}."
1819
+ `);
1768
1820
  });
1821
+ });
1769
1822
 
1770
- it("should error if services is null", () => {
1771
- const { config, diagnostics } = normalizeAndValidateConfig(
1772
- { services: null } as unknown as RawConfig,
1823
+ describe("[r2_buckets]", () => {
1824
+ it("should error if r2_buckets is an object", () => {
1825
+ const { diagnostics } = normalizeAndValidateConfig(
1826
+ { r2_buckets: {} } as unknown as RawConfig,
1773
1827
  undefined,
1774
1828
  { env: undefined }
1775
1829
  );
1776
1830
 
1777
- expect(config).toEqual(
1778
- expect.not.objectContaining({ services: expect.anything })
1779
- );
1780
- expect(diagnostics.hasWarnings()).toBe(true);
1781
- expect(diagnostics.hasErrors()).toBe(true);
1782
- expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1783
- "Processing wrangler configuration:
1784
- - \\"services\\" fields are experimental and may change or break at any time."
1785
- `);
1831
+ expect(diagnostics.hasWarnings()).toBe(false);
1786
1832
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1787
- "Processing wrangler configuration:
1788
- - The field \\"services\\" should be an array but got null."
1789
- `);
1833
+ "Processing wrangler configuration:
1834
+ - The field \\"r2_buckets\\" should be an array but got {}."
1835
+ `);
1790
1836
  });
1791
1837
 
1792
- it("should error if services bindings are not valid", () => {
1793
- const { config, diagnostics } = normalizeAndValidateConfig(
1794
- {
1795
- services: [
1796
- {},
1797
- { binding: "SERVICE_BINDING_1" },
1798
- { binding: 123, service: 456 },
1799
- { binding: 123, service: 456, environment: 789 },
1838
+ it("should error if r2_buckets is a string", () => {
1839
+ const { diagnostics } = normalizeAndValidateConfig(
1840
+ { r2_buckets: "BAD" } as unknown as RawConfig,
1841
+ undefined,
1842
+ { env: undefined }
1843
+ );
1844
+
1845
+ expect(diagnostics.hasWarnings()).toBe(false);
1846
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1847
+ "Processing wrangler configuration:
1848
+ - The field \\"r2_buckets\\" should be an array but got \\"BAD\\"."
1849
+ `);
1850
+ });
1851
+
1852
+ it("should error if r2_buckets is a number", () => {
1853
+ const { diagnostics } = normalizeAndValidateConfig(
1854
+ { r2_buckets: 999 } as unknown as RawConfig,
1855
+ undefined,
1856
+ { env: undefined }
1857
+ );
1858
+
1859
+ expect(diagnostics.hasWarnings()).toBe(false);
1860
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1861
+ "Processing wrangler configuration:
1862
+ - The field \\"r2_buckets\\" should be an array but got 999."
1863
+ `);
1864
+ });
1865
+
1866
+ it("should error if r2_buckets is null", () => {
1867
+ const { diagnostics } = normalizeAndValidateConfig(
1868
+ { r2_buckets: null } as unknown as RawConfig,
1869
+ undefined,
1870
+ { env: undefined }
1871
+ );
1872
+
1873
+ expect(diagnostics.hasWarnings()).toBe(false);
1874
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1875
+ "Processing wrangler configuration:
1876
+ - The field \\"r2_buckets\\" should be an array but got null."
1877
+ `);
1878
+ });
1879
+
1880
+ it("should error if r2_buckets.bindings are not valid", () => {
1881
+ const { diagnostics } = normalizeAndValidateConfig(
1882
+ {
1883
+ r2_buckets: [
1884
+ {},
1885
+ { binding: "R2_BINDING_1" },
1886
+ { binding: 2333, bucket_name: 2444 },
1887
+ {
1888
+ binding: "R2_BINDING_2",
1889
+ bucket_name: "R2_BUCKET_2",
1890
+ preview_bucket_name: 2555,
1891
+ },
1892
+ { binding: "R2_BINDING_1", bucket_name: "" },
1893
+ ],
1894
+ } as unknown as RawConfig,
1895
+ undefined,
1896
+ { env: undefined }
1897
+ );
1898
+
1899
+ expect(diagnostics.hasWarnings()).toBe(false);
1900
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1901
+ "Processing wrangler configuration:
1902
+ - \\"r2_buckets[0]\\" bindings should have a string \\"binding\\" field but got {}.
1903
+ - \\"r2_buckets[0]\\" bindings should have a string \\"bucket_name\\" field but got {}.
1904
+ - \\"r2_buckets[1]\\" bindings should have a string \\"bucket_name\\" field but got {\\"binding\\":\\"R2_BINDING_1\\"}.
1905
+ - \\"r2_buckets[2]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2333,\\"bucket_name\\":2444}.
1906
+ - \\"r2_buckets[2]\\" bindings should have a string \\"bucket_name\\" field but got {\\"binding\\":2333,\\"bucket_name\\":2444}.
1907
+ - \\"r2_buckets[3]\\" bindings should, optionally, have a string \\"preview_bucket_name\\" field but got {\\"binding\\":\\"R2_BINDING_2\\",\\"bucket_name\\":\\"R2_BUCKET_2\\",\\"preview_bucket_name\\":2555}.
1908
+ - \\"r2_buckets[4]\\" bindings should have a string \\"bucket_name\\" field but got {\\"binding\\":\\"R2_BINDING_1\\",\\"bucket_name\\":\\"\\"}."
1909
+ `);
1910
+ });
1911
+ });
1912
+
1913
+ describe("[services]", () => {
1914
+ it("should error if services is an object", () => {
1915
+ const { diagnostics } = normalizeAndValidateConfig(
1916
+ { services: {} } as unknown as RawConfig,
1917
+ undefined,
1918
+ { env: undefined }
1919
+ );
1920
+
1921
+ expect(diagnostics.hasWarnings()).toBe(true);
1922
+ expect(diagnostics.hasErrors()).toBe(true);
1923
+ expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1924
+ "Processing wrangler configuration:
1925
+ - \\"services\\" fields are experimental and may change or break at any time."
1926
+ `);
1927
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1928
+ "Processing wrangler configuration:
1929
+ - The field \\"services\\" should be an array but got {}."
1930
+ `);
1931
+ });
1932
+
1933
+ it("should error if services is a string", () => {
1934
+ const { diagnostics } = normalizeAndValidateConfig(
1935
+ { services: "BAD" } as unknown as RawConfig,
1936
+ undefined,
1937
+ { env: undefined }
1938
+ );
1939
+
1940
+ expect(diagnostics.hasWarnings()).toBe(true);
1941
+ expect(diagnostics.hasErrors()).toBe(true);
1942
+ expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1943
+ "Processing wrangler configuration:
1944
+ - \\"services\\" fields are experimental and may change or break at any time."
1945
+ `);
1946
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1947
+ "Processing wrangler configuration:
1948
+ - The field \\"services\\" should be an array but got \\"BAD\\"."
1949
+ `);
1950
+ });
1951
+
1952
+ it("should error if services is a number", () => {
1953
+ const { diagnostics } = normalizeAndValidateConfig(
1954
+ { services: 999 } as unknown as RawConfig,
1955
+ undefined,
1956
+ { env: undefined }
1957
+ );
1958
+
1959
+ expect(diagnostics.hasWarnings()).toBe(true);
1960
+ expect(diagnostics.hasErrors()).toBe(true);
1961
+ expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1962
+ "Processing wrangler configuration:
1963
+ - \\"services\\" fields are experimental and may change or break at any time."
1964
+ `);
1965
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1966
+ "Processing wrangler configuration:
1967
+ - The field \\"services\\" should be an array but got 999."
1968
+ `);
1969
+ });
1970
+
1971
+ it("should error if services is null", () => {
1972
+ const { diagnostics } = normalizeAndValidateConfig(
1973
+ { services: null } as unknown as RawConfig,
1974
+ undefined,
1975
+ { env: undefined }
1976
+ );
1977
+
1978
+ expect(diagnostics.hasWarnings()).toBe(true);
1979
+ expect(diagnostics.hasErrors()).toBe(true);
1980
+ expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1981
+ "Processing wrangler configuration:
1982
+ - \\"services\\" fields are experimental and may change or break at any time."
1983
+ `);
1984
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1985
+ "Processing wrangler configuration:
1986
+ - The field \\"services\\" should be an array but got null."
1987
+ `);
1988
+ });
1989
+
1990
+ it("should error if services bindings are not valid", () => {
1991
+ const { diagnostics } = normalizeAndValidateConfig(
1992
+ {
1993
+ services: [
1994
+ {},
1995
+ { binding: "SERVICE_BINDING_1" },
1996
+ { binding: 123, service: 456 },
1997
+ { binding: 123, service: 456, environment: 789 },
1800
1998
  { binding: "SERVICE_BINDING_1", service: 456, environment: 789 },
1801
1999
  {
1802
2000
  binding: 123,
@@ -1814,11 +2012,6 @@ describe("normalizeAndValidateConfig()", () => {
1814
2012
  { env: undefined }
1815
2013
  );
1816
2014
 
1817
- expect(config).toEqual(
1818
- expect.not.objectContaining({
1819
- services: { bindings: expect.anything },
1820
- })
1821
- );
1822
2015
  expect(diagnostics.hasWarnings()).toBe(true);
1823
2016
  expect(diagnostics.hasErrors()).toBe(true);
1824
2017
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
@@ -1845,59 +2038,114 @@ describe("normalizeAndValidateConfig()", () => {
1845
2038
  });
1846
2039
  });
1847
2040
 
1848
- describe("[worker_namespaces]", () => {
1849
- it("should log an experimental warning when worker_namespaces is used", () => {
1850
- const { config, diagnostics } = normalizeAndValidateConfig(
2041
+ describe("[analytics_engine_datasets]", () => {
2042
+ it("should error if analytics_engine_datasets is an object", () => {
2043
+ const { diagnostics } = normalizeAndValidateConfig(
2044
+ { analytics_engine_datasets: {} } as unknown as RawConfig,
2045
+ undefined,
2046
+ { env: undefined }
2047
+ );
2048
+
2049
+ expect(diagnostics.hasWarnings()).toBe(false);
2050
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2051
+ "Processing wrangler configuration:
2052
+ - The field \\"analytics_engine_datasets\\" should be an array but got {}."
2053
+ `);
2054
+ });
2055
+
2056
+ it("should error if analytics_engine_datasets is a string", () => {
2057
+ const { diagnostics } = normalizeAndValidateConfig(
2058
+ { analytics_engine_datasets: "BAD" } as unknown as RawConfig,
2059
+ undefined,
2060
+ { env: undefined }
2061
+ );
2062
+
2063
+ expect(diagnostics.hasWarnings()).toBe(false);
2064
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2065
+ "Processing wrangler configuration:
2066
+ - The field \\"analytics_engine_datasets\\" should be an array but got \\"BAD\\"."
2067
+ `);
2068
+ });
2069
+
2070
+ it("should error if analytics_engine_datasets is a number", () => {
2071
+ const { diagnostics } = normalizeAndValidateConfig(
2072
+ { analytics_engine_datasets: 999 } as unknown as RawConfig,
2073
+ undefined,
2074
+ { env: undefined }
2075
+ );
2076
+
2077
+ expect(diagnostics.hasWarnings()).toBe(false);
2078
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2079
+ "Processing wrangler configuration:
2080
+ - The field \\"analytics_engine_datasets\\" should be an array but got 999."
2081
+ `);
2082
+ });
2083
+
2084
+ it("should error if analytics_engine_datasets is null", () => {
2085
+ const { diagnostics } = normalizeAndValidateConfig(
2086
+ { analytics_engine_datasets: null } as unknown as RawConfig,
2087
+ undefined,
2088
+ { env: undefined }
2089
+ );
2090
+
2091
+ expect(diagnostics.hasWarnings()).toBe(false);
2092
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2093
+ "Processing wrangler configuration:
2094
+ - The field \\"analytics_engine_datasets\\" should be an array but got null."
2095
+ `);
2096
+ });
2097
+
2098
+ it("should error if analytics_engine_datasets.bindings are not valid", () => {
2099
+ const { diagnostics } = normalizeAndValidateConfig(
1851
2100
  {
1852
- worker_namespaces: [
2101
+ analytics_engine_datasets: [
2102
+ {},
2103
+ { binding: 2333, dataset: 2444 },
1853
2104
  {
1854
- binding: "BINDING_1",
1855
- namespace: "NAMESPACE_1",
2105
+ binding: "AE_BINDING_2",
2106
+ dataset: 2555,
1856
2107
  },
2108
+ { binding: "AE_BINDING_1", dataset: "" },
1857
2109
  ],
1858
2110
  } as unknown as RawConfig,
1859
2111
  undefined,
1860
2112
  { env: undefined }
1861
2113
  );
1862
- expect(config).toEqual(
1863
- expect.not.objectContaining({ worker_namespaces: expect.anything })
1864
- );
1865
- expect(diagnostics.hasWarnings()).toBe(true);
1866
- expect(diagnostics.hasErrors()).toBe(false);
1867
- expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1868
- "Processing wrangler configuration:
1869
- - \\"worker_namespaces\\" fields are experimental and may change or break at any time."
1870
- `);
2114
+
2115
+ expect(diagnostics.hasWarnings()).toBe(false);
2116
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2117
+ "Processing wrangler configuration:
2118
+ - \\"analytics_engine_datasets[0]\\" bindings should have a string \\"binding\\" field but got {}.
2119
+ - \\"analytics_engine_datasets[1]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2333,\\"dataset\\":2444}.
2120
+ - \\"analytics_engine_datasets[1]\\" bindings should, optionally, have a string \\"dataset\\" field but got {\\"binding\\":2333,\\"dataset\\":2444}.
2121
+ - \\"analytics_engine_datasets[2]\\" bindings should, optionally, have a string \\"dataset\\" field but got {\\"binding\\":\\"AE_BINDING_2\\",\\"dataset\\":2555}.
2122
+ - \\"analytics_engine_datasets[3]\\" bindings should, optionally, have a string \\"dataset\\" field but got {\\"binding\\":\\"AE_BINDING_1\\",\\"dataset\\":\\"\\"}."
2123
+ `);
1871
2124
  });
2125
+ });
1872
2126
 
1873
- it("should error if worker_namespaces is not an array", () => {
1874
- const { config, diagnostics } = normalizeAndValidateConfig(
2127
+ describe("[dispatch_namespaces]", () => {
2128
+ it("should error if dispatch_namespaces is not an array", () => {
2129
+ const { diagnostics } = normalizeAndValidateConfig(
1875
2130
  {
1876
- worker_namespaces: "just a string",
2131
+ dispatch_namespaces: "just a string",
1877
2132
  } as unknown as RawConfig,
1878
2133
  undefined,
1879
2134
  { env: undefined }
1880
2135
  );
1881
2136
 
1882
- expect(config).toEqual(
1883
- expect.not.objectContaining({ worker_namespaces: expect.anything })
1884
- );
1885
- expect(diagnostics.hasWarnings()).toBe(true);
2137
+ expect(diagnostics.hasWarnings()).toBe(false);
1886
2138
  expect(diagnostics.hasErrors()).toBe(true);
1887
- expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1888
- "Processing wrangler configuration:
1889
- - \\"worker_namespaces\\" fields are experimental and may change or break at any time."
1890
- `);
1891
2139
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1892
2140
  "Processing wrangler configuration:
1893
- - The field \\"worker_namespaces\\" should be an array but got \\"just a string\\"."
2141
+ - The field \\"dispatch_namespaces\\" should be an array but got \\"just a string\\"."
1894
2142
  `);
1895
2143
  });
1896
2144
 
1897
- it("should error on non valid worker_namespaces", () => {
1898
- const { config, diagnostics } = normalizeAndValidateConfig(
2145
+ it("should error on non valid dispatch_namespaces", () => {
2146
+ const { diagnostics } = normalizeAndValidateConfig(
1899
2147
  {
1900
- worker_namespaces: [
2148
+ dispatch_namespaces: [
1901
2149
  "a string",
1902
2150
  123,
1903
2151
  {
@@ -1905,17 +2153,17 @@ describe("normalizeAndValidateConfig()", () => {
1905
2153
  namespace: 456,
1906
2154
  },
1907
2155
  {
1908
- binding: "WORKER_NAMESPACE_BINDING_1",
2156
+ binding: "DISPATCH_NAMESPACE_BINDING_1",
1909
2157
  namespace: 456,
1910
2158
  },
1911
2159
  // this one is valid
1912
2160
  {
1913
- binding: "WORKER_NAMESPACE_BINDING_1",
1914
- namespace: "WORKER_NAMESPACE_BINDING_NAMESPACE_1",
2161
+ binding: "DISPATCH_NAMESPACE_BINDING_1",
2162
+ namespace: "DISPATCH_NAMESPACE_BINDING_NAMESPACE_1",
1915
2163
  },
1916
2164
  {
1917
2165
  binding: 123,
1918
- namespace: "WORKER_NAMESPACE_BINDING_SERVICE_1",
2166
+ namespace: "DISPATCH_NAMESPACE_BINDING_SERVICE_1",
1919
2167
  },
1920
2168
  {
1921
2169
  binding: 123,
@@ -1926,42 +2174,30 @@ describe("normalizeAndValidateConfig()", () => {
1926
2174
  undefined,
1927
2175
  { env: undefined }
1928
2176
  );
1929
- expect(config).toEqual(
1930
- expect.not.objectContaining({
1931
- worker_namespaces: expect.anything,
1932
- })
1933
- );
1934
- expect(diagnostics.hasWarnings()).toBe(true);
2177
+ expect(diagnostics.hasWarnings()).toBe(false);
1935
2178
  expect(diagnostics.hasErrors()).toBe(true);
1936
- expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1937
- "Processing wrangler configuration:
1938
- - \\"worker_namespaces\\" fields are experimental and may change or break at any time."
1939
- `);
1940
2179
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
1941
2180
  "Processing wrangler configuration:
1942
- - \\"worker_namespaces[0]\\" binding should be objects, but got \\"a string\\"
1943
- - \\"worker_namespaces[1]\\" binding should be objects, but got 123
1944
- - \\"worker_namespaces[2]\\" should have a string \\"binding\\" field but got {\\"binding\\":123,\\"namespace\\":456}.
1945
- - \\"worker_namespaces[2]\\" should have a string \\"namespace\\" field but got {\\"binding\\":123,\\"namespace\\":456}.
1946
- - \\"worker_namespaces[3]\\" should have a string \\"namespace\\" field but got {\\"binding\\":\\"WORKER_NAMESPACE_BINDING_1\\",\\"namespace\\":456}.
1947
- - \\"worker_namespaces[5]\\" should have a string \\"binding\\" field but got {\\"binding\\":123,\\"namespace\\":\\"WORKER_NAMESPACE_BINDING_SERVICE_1\\"}.
1948
- - \\"worker_namespaces[6]\\" should have a string \\"binding\\" field but got {\\"binding\\":123,\\"service\\":456}.
1949
- - \\"worker_namespaces[6]\\" should have a string \\"namespace\\" field but got {\\"binding\\":123,\\"service\\":456}."
2181
+ - \\"dispatch_namespaces[0]\\" binding should be objects, but got \\"a string\\"
2182
+ - \\"dispatch_namespaces[1]\\" binding should be objects, but got 123
2183
+ - \\"dispatch_namespaces[2]\\" should have a string \\"binding\\" field but got {\\"binding\\":123,\\"namespace\\":456}.
2184
+ - \\"dispatch_namespaces[2]\\" should have a string \\"namespace\\" field but got {\\"binding\\":123,\\"namespace\\":456}.
2185
+ - \\"dispatch_namespaces[3]\\" should have a string \\"namespace\\" field but got {\\"binding\\":\\"DISPATCH_NAMESPACE_BINDING_1\\",\\"namespace\\":456}.
2186
+ - \\"dispatch_namespaces[5]\\" should have a string \\"binding\\" field but got {\\"binding\\":123,\\"namespace\\":\\"DISPATCH_NAMESPACE_BINDING_SERVICE_1\\"}.
2187
+ - \\"dispatch_namespaces[6]\\" should have a string \\"binding\\" field but got {\\"binding\\":123,\\"service\\":456}.
2188
+ - \\"dispatch_namespaces[6]\\" should have a string \\"namespace\\" field but got {\\"binding\\":123,\\"service\\":456}."
1950
2189
  `);
1951
2190
  });
1952
2191
  });
1953
2192
 
1954
2193
  describe("[unsafe.bindings]", () => {
1955
2194
  it("should error if unsafe is an array", () => {
1956
- const { config, diagnostics } = normalizeAndValidateConfig(
2195
+ const { diagnostics } = normalizeAndValidateConfig(
1957
2196
  { unsafe: [] } as unknown as RawConfig,
1958
2197
  undefined,
1959
2198
  { env: undefined }
1960
2199
  );
1961
2200
 
1962
- expect(config).toEqual(
1963
- expect.not.objectContaining({ unsafe: expect.anything })
1964
- );
1965
2201
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1966
2202
  "Processing wrangler configuration:
1967
2203
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -1973,15 +2209,12 @@ describe("normalizeAndValidateConfig()", () => {
1973
2209
  });
1974
2210
 
1975
2211
  it("should error if unsafe is a string", () => {
1976
- const { config, diagnostics } = normalizeAndValidateConfig(
2212
+ const { diagnostics } = normalizeAndValidateConfig(
1977
2213
  { unsafe: "BAD" } as unknown as RawConfig,
1978
2214
  undefined,
1979
2215
  { env: undefined }
1980
2216
  );
1981
2217
 
1982
- expect(config).toEqual(
1983
- expect.not.objectContaining({ unsafe: expect.anything })
1984
- );
1985
2218
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
1986
2219
  "Processing wrangler configuration:
1987
2220
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -1993,15 +2226,12 @@ describe("normalizeAndValidateConfig()", () => {
1993
2226
  });
1994
2227
 
1995
2228
  it("should error if unsafe is a number", () => {
1996
- const { config, diagnostics } = normalizeAndValidateConfig(
2229
+ const { diagnostics } = normalizeAndValidateConfig(
1997
2230
  { unsafe: 999 } as unknown as RawConfig,
1998
2231
  undefined,
1999
2232
  { env: undefined }
2000
2233
  );
2001
2234
 
2002
- expect(config).toEqual(
2003
- expect.not.objectContaining({ unsafe: expect.anything })
2004
- );
2005
2235
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2006
2236
  "Processing wrangler configuration:
2007
2237
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2013,15 +2243,12 @@ describe("normalizeAndValidateConfig()", () => {
2013
2243
  });
2014
2244
 
2015
2245
  it("should error if unsafe is null", () => {
2016
- const { config, diagnostics } = normalizeAndValidateConfig(
2246
+ const { diagnostics } = normalizeAndValidateConfig(
2017
2247
  { unsafe: null } as unknown as RawConfig,
2018
2248
  undefined,
2019
2249
  { env: undefined }
2020
2250
  );
2021
2251
 
2022
- expect(config).toEqual(
2023
- expect.not.objectContaining({ unsafe: expect.anything })
2024
- );
2025
2252
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2026
2253
  "Processing wrangler configuration:
2027
2254
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2033,15 +2260,12 @@ describe("normalizeAndValidateConfig()", () => {
2033
2260
  });
2034
2261
 
2035
2262
  it("should error if unsafe.bindings is not defined", () => {
2036
- const { config, diagnostics } = normalizeAndValidateConfig(
2263
+ const { diagnostics } = normalizeAndValidateConfig(
2037
2264
  { unsafe: {} } as unknown as RawConfig,
2038
2265
  undefined,
2039
2266
  { env: undefined }
2040
2267
  );
2041
2268
 
2042
- expect(config).toEqual(
2043
- expect.not.objectContaining({ unsafe: expect.anything })
2044
- );
2045
2269
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2046
2270
  "Processing wrangler configuration:
2047
2271
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2053,17 +2277,12 @@ describe("normalizeAndValidateConfig()", () => {
2053
2277
  });
2054
2278
 
2055
2279
  it("should error if unsafe.bindings is an object", () => {
2056
- const { config, diagnostics } = normalizeAndValidateConfig(
2280
+ const { diagnostics } = normalizeAndValidateConfig(
2057
2281
  { unsafe: { bindings: {} } } as unknown as RawConfig,
2058
2282
  undefined,
2059
2283
  { env: undefined }
2060
2284
  );
2061
2285
 
2062
- expect(config).toEqual(
2063
- expect.not.objectContaining({
2064
- unsafe: { bindings: expect.anything },
2065
- })
2066
- );
2067
2286
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2068
2287
  "Processing wrangler configuration:
2069
2288
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2075,17 +2294,12 @@ describe("normalizeAndValidateConfig()", () => {
2075
2294
  });
2076
2295
 
2077
2296
  it("should error if unsafe.bindings is a string", () => {
2078
- const { config, diagnostics } = normalizeAndValidateConfig(
2297
+ const { diagnostics } = normalizeAndValidateConfig(
2079
2298
  { unsafe: { bindings: "BAD" } } as unknown as RawConfig,
2080
2299
  undefined,
2081
2300
  { env: undefined }
2082
2301
  );
2083
2302
 
2084
- expect(config).toEqual(
2085
- expect.not.objectContaining({
2086
- unsafe: { bindings: expect.anything },
2087
- })
2088
- );
2089
2303
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2090
2304
  "Processing wrangler configuration:
2091
2305
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2097,17 +2311,12 @@ describe("normalizeAndValidateConfig()", () => {
2097
2311
  });
2098
2312
 
2099
2313
  it("should error if unsafe.bindings is a number", () => {
2100
- const { config, diagnostics } = normalizeAndValidateConfig(
2314
+ const { diagnostics } = normalizeAndValidateConfig(
2101
2315
  { unsafe: { bindings: 999 } } as unknown as RawConfig,
2102
2316
  undefined,
2103
2317
  { env: undefined }
2104
2318
  );
2105
2319
 
2106
- expect(config).toEqual(
2107
- expect.not.objectContaining({
2108
- unsafe: { bindings: expect.anything },
2109
- })
2110
- );
2111
2320
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2112
2321
  "Processing wrangler configuration:
2113
2322
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2119,17 +2328,12 @@ describe("normalizeAndValidateConfig()", () => {
2119
2328
  });
2120
2329
 
2121
2330
  it("should error if unsafe.bindings is null", () => {
2122
- const { config, diagnostics } = normalizeAndValidateConfig(
2331
+ const { diagnostics } = normalizeAndValidateConfig(
2123
2332
  { unsafe: { bindings: null } } as unknown as RawConfig,
2124
2333
  undefined,
2125
2334
  { env: undefined }
2126
2335
  );
2127
2336
 
2128
- expect(config).toEqual(
2129
- expect.not.objectContaining({
2130
- unsafe: { bindings: expect.anything },
2131
- })
2132
- );
2133
2337
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2134
2338
  "Processing wrangler configuration:
2135
2339
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2141,7 +2345,7 @@ describe("normalizeAndValidateConfig()", () => {
2141
2345
  });
2142
2346
 
2143
2347
  it("should error if durable_objects.bindings are not valid", () => {
2144
- const { config, diagnostics } = normalizeAndValidateConfig(
2348
+ const { diagnostics } = normalizeAndValidateConfig(
2145
2349
  {
2146
2350
  unsafe: {
2147
2351
  bindings: [
@@ -2160,11 +2364,6 @@ describe("normalizeAndValidateConfig()", () => {
2160
2364
  { env: undefined }
2161
2365
  );
2162
2366
 
2163
- expect(config).toEqual(
2164
- expect.not.objectContaining({
2165
- durable_objects: { bindings: expect.anything },
2166
- })
2167
- );
2168
2367
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2169
2368
  "Processing wrangler configuration:
2170
2369
  - \\"unsafe\\" fields are experimental and may change or break at any time."
@@ -2311,6 +2510,8 @@ describe("normalizeAndValidateConfig()", () => {
2311
2510
  no_bundle: true,
2312
2511
  minify: true,
2313
2512
  node_compat: true,
2513
+ first_party_worker: true,
2514
+ logpush: true,
2314
2515
  };
2315
2516
 
2316
2517
  const { config, diagnostics } = normalizeAndValidateConfig(
@@ -2354,6 +2555,8 @@ describe("normalizeAndValidateConfig()", () => {
2354
2555
  no_bundle: false,
2355
2556
  minify: false,
2356
2557
  node_compat: false,
2558
+ first_party_worker: false,
2559
+ logpush: false,
2357
2560
  };
2358
2561
  const rawConfig: RawConfig = {
2359
2562
  name: "mock-name",
@@ -2376,6 +2579,8 @@ describe("normalizeAndValidateConfig()", () => {
2376
2579
  no_bundle: true,
2377
2580
  minify: true,
2378
2581
  node_compat: true,
2582
+ first_party_worker: true,
2583
+ logpush: true,
2379
2584
  env: {
2380
2585
  ENV1: rawEnv,
2381
2586
  },
@@ -2559,6 +2764,8 @@ describe("normalizeAndValidateConfig()", () => {
2559
2764
  };
2560
2765
  const kv_namespaces: RawConfig["kv_namespaces"] = [];
2561
2766
  const r2_buckets: RawConfig["r2_buckets"] = [];
2767
+ const analytics_engine_datasets: RawConfig["analytics_engine_datasets"] =
2768
+ [];
2562
2769
  const unsafe: RawConfig["unsafe"] = { bindings: [] };
2563
2770
  const rawConfig: RawConfig = {
2564
2771
  define,
@@ -2566,6 +2773,7 @@ describe("normalizeAndValidateConfig()", () => {
2566
2773
  durable_objects,
2567
2774
  kv_namespaces,
2568
2775
  r2_buckets,
2776
+ analytics_engine_datasets,
2569
2777
  unsafe,
2570
2778
  env: {
2571
2779
  ENV1: {},
@@ -2585,33 +2793,37 @@ describe("normalizeAndValidateConfig()", () => {
2585
2793
  durable_objects,
2586
2794
  kv_namespaces,
2587
2795
  r2_buckets,
2796
+ analytics_engine_datasets,
2588
2797
  unsafe,
2589
2798
  })
2590
2799
  );
2591
2800
  expect(diagnostics.hasErrors()).toBe(false);
2592
2801
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
2593
- "Processing wrangler configuration:
2594
- - \\"unsafe\\" fields are experimental and may change or break at any time.
2595
- - \\"env.ENV1\\" environment configuration
2596
- - \\"vars\\" exists at the top level, but not on \\"env.ENV1\\".
2597
- This is not what you probably want, since \\"vars\\" is not inherited by environments.
2598
- Please add \\"vars\\" to \\"env.ENV1\\".
2599
- - \\"define\\" exists at the top level, but not on \\"env.ENV1\\".
2600
- This is not what you probably want, since \\"define\\" is not inherited by environments.
2601
- Please add \\"define\\" to \\"env.ENV1\\".
2602
- - \\"durable_objects\\" exists at the top level, but not on \\"env.ENV1\\".
2603
- This is not what you probably want, since \\"durable_objects\\" is not inherited by environments.
2604
- Please add \\"durable_objects\\" to \\"env.ENV1\\".
2605
- - \\"kv_namespaces\\" exists at the top level, but not on \\"env.ENV1\\".
2606
- This is not what you probably want, since \\"kv_namespaces\\" is not inherited by environments.
2607
- Please add \\"kv_namespaces\\" to \\"env.ENV1\\".
2608
- - \\"r2_buckets\\" exists at the top level, but not on \\"env.ENV1\\".
2609
- This is not what you probably want, since \\"r2_buckets\\" is not inherited by environments.
2610
- Please add \\"r2_buckets\\" to \\"env.ENV1\\".
2611
- - \\"unsafe\\" exists at the top level, but not on \\"env.ENV1\\".
2612
- This is not what you probably want, since \\"unsafe\\" is not inherited by environments.
2613
- Please add \\"unsafe\\" to \\"env.ENV1\\"."
2614
- `);
2802
+ "Processing wrangler configuration:
2803
+ - \\"unsafe\\" fields are experimental and may change or break at any time.
2804
+ - \\"env.ENV1\\" environment configuration
2805
+ - \\"vars\\" exists at the top level, but not on \\"env.ENV1\\".
2806
+ This is not what you probably want, since \\"vars\\" is not inherited by environments.
2807
+ Please add \\"vars\\" to \\"env.ENV1\\".
2808
+ - \\"define\\" exists at the top level, but not on \\"env.ENV1\\".
2809
+ This is not what you probably want, since \\"define\\" is not inherited by environments.
2810
+ Please add \\"define\\" to \\"env.ENV1\\".
2811
+ - \\"durable_objects\\" exists at the top level, but not on \\"env.ENV1\\".
2812
+ This is not what you probably want, since \\"durable_objects\\" is not inherited by environments.
2813
+ Please add \\"durable_objects\\" to \\"env.ENV1\\".
2814
+ - \\"kv_namespaces\\" exists at the top level, but not on \\"env.ENV1\\".
2815
+ This is not what you probably want, since \\"kv_namespaces\\" is not inherited by environments.
2816
+ Please add \\"kv_namespaces\\" to \\"env.ENV1\\".
2817
+ - \\"r2_buckets\\" exists at the top level, but not on \\"env.ENV1\\".
2818
+ This is not what you probably want, since \\"r2_buckets\\" is not inherited by environments.
2819
+ Please add \\"r2_buckets\\" to \\"env.ENV1\\".
2820
+ - \\"analytics_engine_datasets\\" exists at the top level, but not on \\"env.ENV1\\".
2821
+ This is not what you probably want, since \\"analytics_engine_datasets\\" is not inherited by environments.
2822
+ Please add \\"analytics_engine_datasets\\" to \\"env.ENV1\\".
2823
+ - \\"unsafe\\" exists at the top level, but not on \\"env.ENV1\\".
2824
+ This is not what you probably want, since \\"unsafe\\" is not inherited by environments.
2825
+ Please add \\"unsafe\\" to \\"env.ENV1\\"."
2826
+ `);
2615
2827
  });
2616
2828
 
2617
2829
  it("should error on invalid environment values", () => {
@@ -2637,6 +2849,8 @@ describe("normalizeAndValidateConfig()", () => {
2637
2849
  no_bundle: "INVALID",
2638
2850
  minify: "INVALID",
2639
2851
  node_compat: "INVALID",
2852
+ first_party_worker: "INVALID",
2853
+ logpush: "INVALID",
2640
2854
  } as unknown as RawEnvironment;
2641
2855
 
2642
2856
  const { config, diagnostics } = normalizeAndValidateConfig(
@@ -2672,7 +2886,9 @@ describe("normalizeAndValidateConfig()", () => {
2672
2886
  - Expected \\"usage_model\\" field to be one of [\\"bundled\\",\\"unbound\\"] but got \\"INVALID\\".
2673
2887
  - Expected \\"no_bundle\\" to be of type boolean but got \\"INVALID\\".
2674
2888
  - Expected \\"minify\\" to be of type boolean but got \\"INVALID\\".
2675
- - Expected \\"node_compat\\" to be of type boolean but got \\"INVALID\\"."
2889
+ - Expected \\"node_compat\\" to be of type boolean but got \\"INVALID\\".
2890
+ - Expected \\"first_party_worker\\" to be of type boolean but got \\"INVALID\\".
2891
+ - Expected \\"logpush\\" to be of type boolean but got \\"INVALID\\"."
2676
2892
  `);
2677
2893
  });
2678
2894
 
@@ -2900,15 +3116,12 @@ describe("normalizeAndValidateConfig()", () => {
2900
3116
 
2901
3117
  describe("[durable_objects]", () => {
2902
3118
  it("should error if durable_objects is an array", () => {
2903
- const { config, diagnostics } = normalizeAndValidateConfig(
3119
+ const { diagnostics } = normalizeAndValidateConfig(
2904
3120
  { env: { ENV1: { durable_objects: [] } } } as unknown as RawConfig,
2905
3121
  undefined,
2906
3122
  { env: "ENV1" }
2907
3123
  );
2908
3124
 
2909
- expect(config).toEqual(
2910
- expect.not.objectContaining({ durable_objects: expect.anything })
2911
- );
2912
3125
  expect(diagnostics.hasWarnings()).toBe(false);
2913
3126
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2914
3127
  "Processing wrangler configuration:
@@ -2919,15 +3132,12 @@ describe("normalizeAndValidateConfig()", () => {
2919
3132
  });
2920
3133
 
2921
3134
  it("should error if durable_objects is a string", () => {
2922
- const { config, diagnostics } = normalizeAndValidateConfig(
3135
+ const { diagnostics } = normalizeAndValidateConfig(
2923
3136
  { env: { ENV1: { durable_objects: "BAD" } } } as unknown as RawConfig,
2924
3137
  undefined,
2925
3138
  { env: "ENV1" }
2926
3139
  );
2927
3140
 
2928
- expect(config).toEqual(
2929
- expect.not.objectContaining({ durable_objects: expect.anything })
2930
- );
2931
3141
  expect(diagnostics.hasWarnings()).toBe(false);
2932
3142
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2933
3143
  "Processing wrangler configuration:
@@ -2938,15 +3148,12 @@ describe("normalizeAndValidateConfig()", () => {
2938
3148
  });
2939
3149
 
2940
3150
  it("should error if durable_objects is a number", () => {
2941
- const { config, diagnostics } = normalizeAndValidateConfig(
3151
+ const { diagnostics } = normalizeAndValidateConfig(
2942
3152
  { env: { ENV1: { durable_objects: 999 } } } as unknown as RawConfig,
2943
3153
  undefined,
2944
3154
  { env: "ENV1" }
2945
3155
  );
2946
3156
 
2947
- expect(config).toEqual(
2948
- expect.not.objectContaining({ durable_objects: expect.anything })
2949
- );
2950
3157
  expect(diagnostics.hasWarnings()).toBe(false);
2951
3158
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2952
3159
  "Processing wrangler configuration:
@@ -2957,15 +3164,12 @@ describe("normalizeAndValidateConfig()", () => {
2957
3164
  });
2958
3165
 
2959
3166
  it("should error if durable_objects is null", () => {
2960
- const { config, diagnostics } = normalizeAndValidateConfig(
3167
+ const { diagnostics } = normalizeAndValidateConfig(
2961
3168
  { env: { ENV1: { durable_objects: null } } } as unknown as RawConfig,
2962
3169
  undefined,
2963
3170
  { env: "ENV1" }
2964
3171
  );
2965
3172
 
2966
- expect(config).toEqual(
2967
- expect.not.objectContaining({ durable_objects: expect.anything })
2968
- );
2969
3173
  expect(diagnostics.hasWarnings()).toBe(false);
2970
3174
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2971
3175
  "Processing wrangler configuration:
@@ -2976,15 +3180,12 @@ describe("normalizeAndValidateConfig()", () => {
2976
3180
  });
2977
3181
 
2978
3182
  it("should error if durable_objects.bindings is not defined", () => {
2979
- const { config, diagnostics } = normalizeAndValidateConfig(
3183
+ const { diagnostics } = normalizeAndValidateConfig(
2980
3184
  { env: { ENV1: { durable_objects: {} } } } as unknown as RawConfig,
2981
3185
  undefined,
2982
3186
  { env: "ENV1" }
2983
3187
  );
2984
3188
 
2985
- expect(config).toEqual(
2986
- expect.not.objectContaining({ durable_objects: expect.anything })
2987
- );
2988
3189
  expect(diagnostics.hasWarnings()).toBe(false);
2989
3190
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
2990
3191
  "Processing wrangler configuration:
@@ -2995,7 +3196,7 @@ describe("normalizeAndValidateConfig()", () => {
2995
3196
  });
2996
3197
 
2997
3198
  it("should error if durable_objects.bindings is an object", () => {
2998
- const { config, diagnostics } = normalizeAndValidateConfig(
3199
+ const { diagnostics } = normalizeAndValidateConfig(
2999
3200
  {
3000
3201
  env: { ENV1: { durable_objects: { bindings: {} } } },
3001
3202
  } as unknown as RawConfig,
@@ -3003,11 +3204,6 @@ describe("normalizeAndValidateConfig()", () => {
3003
3204
  { env: "ENV1" }
3004
3205
  );
3005
3206
 
3006
- expect(config).toEqual(
3007
- expect.not.objectContaining({
3008
- durable_objects: { bindings: expect.anything },
3009
- })
3010
- );
3011
3207
  expect(diagnostics.hasWarnings()).toBe(false);
3012
3208
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3013
3209
  "Processing wrangler configuration:
@@ -3018,7 +3214,7 @@ describe("normalizeAndValidateConfig()", () => {
3018
3214
  });
3019
3215
 
3020
3216
  it("should error if durable_objects.bindings is a string", () => {
3021
- const { config, diagnostics } = normalizeAndValidateConfig(
3217
+ const { diagnostics } = normalizeAndValidateConfig(
3022
3218
  {
3023
3219
  env: { ENV1: { durable_objects: { bindings: "BAD" } } },
3024
3220
  } as unknown as RawConfig,
@@ -3026,11 +3222,6 @@ describe("normalizeAndValidateConfig()", () => {
3026
3222
  { env: "ENV1" }
3027
3223
  );
3028
3224
 
3029
- expect(config).toEqual(
3030
- expect.not.objectContaining({
3031
- durable_objects: { bindings: expect.anything },
3032
- })
3033
- );
3034
3225
  expect(diagnostics.hasWarnings()).toBe(false);
3035
3226
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3036
3227
  "Processing wrangler configuration:
@@ -3041,7 +3232,7 @@ describe("normalizeAndValidateConfig()", () => {
3041
3232
  });
3042
3233
 
3043
3234
  it("should error if durable_objects.bindings is a number", () => {
3044
- const { config, diagnostics } = normalizeAndValidateConfig(
3235
+ const { diagnostics } = normalizeAndValidateConfig(
3045
3236
  {
3046
3237
  env: { ENV1: { durable_objects: { bindings: 999 } } },
3047
3238
  } as unknown as RawConfig,
@@ -3049,11 +3240,6 @@ describe("normalizeAndValidateConfig()", () => {
3049
3240
  { env: "ENV1" }
3050
3241
  );
3051
3242
 
3052
- expect(config).toEqual(
3053
- expect.not.objectContaining({
3054
- durable_objects: { bindings: expect.anything },
3055
- })
3056
- );
3057
3243
  expect(diagnostics.hasWarnings()).toBe(false);
3058
3244
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3059
3245
  "Processing wrangler configuration:
@@ -3064,7 +3250,7 @@ describe("normalizeAndValidateConfig()", () => {
3064
3250
  });
3065
3251
 
3066
3252
  it("should error if durable_objects.bindings is null", () => {
3067
- const { config, diagnostics } = normalizeAndValidateConfig(
3253
+ const { diagnostics } = normalizeAndValidateConfig(
3068
3254
  {
3069
3255
  env: { ENV1: { durable_objects: { bindings: null } } },
3070
3256
  } as unknown as RawConfig,
@@ -3072,11 +3258,6 @@ describe("normalizeAndValidateConfig()", () => {
3072
3258
  { env: "ENV1" }
3073
3259
  );
3074
3260
 
3075
- expect(config).toEqual(
3076
- expect.not.objectContaining({
3077
- durable_objects: { bindings: expect.anything },
3078
- })
3079
- );
3080
3261
  expect(diagnostics.hasWarnings()).toBe(false);
3081
3262
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3082
3263
  "Processing wrangler configuration:
@@ -3087,7 +3268,7 @@ describe("normalizeAndValidateConfig()", () => {
3087
3268
  });
3088
3269
 
3089
3270
  it("should error if durable_objects.bindings are not valid", () => {
3090
- const { config, diagnostics } = normalizeAndValidateConfig(
3271
+ const { diagnostics } = normalizeAndValidateConfig(
3091
3272
  {
3092
3273
  env: {
3093
3274
  ENV1: {
@@ -3110,11 +3291,6 @@ describe("normalizeAndValidateConfig()", () => {
3110
3291
  { env: "ENV1" }
3111
3292
  );
3112
3293
 
3113
- expect(config).toEqual(
3114
- expect.not.objectContaining({
3115
- durable_objects: { bindings: expect.anything },
3116
- })
3117
- );
3118
3294
  expect(diagnostics.hasWarnings()).toBe(false);
3119
3295
  expect(diagnostics.hasErrors()).toBe(true);
3120
3296
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
@@ -3143,15 +3319,12 @@ describe("normalizeAndValidateConfig()", () => {
3143
3319
 
3144
3320
  describe("[kv_namespaces]", () => {
3145
3321
  it("should error if kv_namespaces is an object", () => {
3146
- const { config, diagnostics } = normalizeAndValidateConfig(
3322
+ const { diagnostics } = normalizeAndValidateConfig(
3147
3323
  { env: { ENV1: { kv_namespaces: {} } } } as unknown as RawConfig,
3148
3324
  undefined,
3149
3325
  { env: "ENV1" }
3150
3326
  );
3151
3327
 
3152
- expect(config).toEqual(
3153
- expect.not.objectContaining({ kv_namespaces: expect.anything })
3154
- );
3155
3328
  expect(diagnostics.hasWarnings()).toBe(false);
3156
3329
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3157
3330
  "Processing wrangler configuration:
@@ -3162,15 +3335,12 @@ describe("normalizeAndValidateConfig()", () => {
3162
3335
  });
3163
3336
 
3164
3337
  it("should error if kv_namespaces is a string", () => {
3165
- const { config, diagnostics } = normalizeAndValidateConfig(
3338
+ const { diagnostics } = normalizeAndValidateConfig(
3166
3339
  { env: { ENV1: { kv_namespaces: "BAD" } } } as unknown as RawConfig,
3167
3340
  undefined,
3168
3341
  { env: "ENV1" }
3169
3342
  );
3170
3343
 
3171
- expect(config).toEqual(
3172
- expect.not.objectContaining({ kv_namespaces: expect.anything })
3173
- );
3174
3344
  expect(diagnostics.hasWarnings()).toBe(false);
3175
3345
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3176
3346
  "Processing wrangler configuration:
@@ -3181,15 +3351,12 @@ describe("normalizeAndValidateConfig()", () => {
3181
3351
  });
3182
3352
 
3183
3353
  it("should error if kv_namespaces is a number", () => {
3184
- const { config, diagnostics } = normalizeAndValidateConfig(
3354
+ const { diagnostics } = normalizeAndValidateConfig(
3185
3355
  { env: { ENV1: { kv_namespaces: 999 } } } as unknown as RawConfig,
3186
3356
  undefined,
3187
3357
  { env: "ENV1" }
3188
3358
  );
3189
3359
 
3190
- expect(config).toEqual(
3191
- expect.not.objectContaining({ kv_namespaces: expect.anything })
3192
- );
3193
3360
  expect(diagnostics.hasWarnings()).toBe(false);
3194
3361
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3195
3362
  "Processing wrangler configuration:
@@ -3200,15 +3367,12 @@ describe("normalizeAndValidateConfig()", () => {
3200
3367
  });
3201
3368
 
3202
3369
  it("should error if kv_namespaces is null", () => {
3203
- const { config, diagnostics } = normalizeAndValidateConfig(
3370
+ const { diagnostics } = normalizeAndValidateConfig(
3204
3371
  { env: { ENV1: { kv_namespaces: null } } } as unknown as RawConfig,
3205
3372
  undefined,
3206
3373
  { env: "ENV1" }
3207
3374
  );
3208
3375
 
3209
- expect(config).toEqual(
3210
- expect.not.objectContaining({ kv_namespaces: expect.anything })
3211
- );
3212
3376
  expect(diagnostics.hasWarnings()).toBe(false);
3213
3377
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3214
3378
  "Processing wrangler configuration:
@@ -3219,7 +3383,7 @@ describe("normalizeAndValidateConfig()", () => {
3219
3383
  });
3220
3384
 
3221
3385
  it("should error if kv_namespaces.bindings are not valid", () => {
3222
- const { config, diagnostics } = normalizeAndValidateConfig(
3386
+ const { diagnostics } = normalizeAndValidateConfig(
3223
3387
  {
3224
3388
  env: {
3225
3389
  ENV1: {
@@ -3240,11 +3404,6 @@ describe("normalizeAndValidateConfig()", () => {
3240
3404
  { env: "ENV1" }
3241
3405
  );
3242
3406
 
3243
- expect(config).toEqual(
3244
- expect.not.objectContaining({
3245
- kv_namespaces: { bindings: expect.anything },
3246
- })
3247
- );
3248
3407
  expect(diagnostics.hasWarnings()).toBe(false);
3249
3408
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3250
3409
  "Processing wrangler configuration:
@@ -3262,15 +3421,12 @@ describe("normalizeAndValidateConfig()", () => {
3262
3421
 
3263
3422
  describe("[r2_buckets]", () => {
3264
3423
  it("should error if r2_buckets is an object", () => {
3265
- const { config, diagnostics } = normalizeAndValidateConfig(
3424
+ const { diagnostics } = normalizeAndValidateConfig(
3266
3425
  { env: { ENV1: { r2_buckets: {} } } } as unknown as RawConfig,
3267
3426
  undefined,
3268
3427
  { env: "ENV1" }
3269
3428
  );
3270
3429
 
3271
- expect(config).toEqual(
3272
- expect.not.objectContaining({ r2_buckets: expect.anything })
3273
- );
3274
3430
  expect(diagnostics.hasWarnings()).toBe(false);
3275
3431
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3276
3432
  "Processing wrangler configuration:
@@ -3281,15 +3437,12 @@ describe("normalizeAndValidateConfig()", () => {
3281
3437
  });
3282
3438
 
3283
3439
  it("should error if r2_buckets is a string", () => {
3284
- const { config, diagnostics } = normalizeAndValidateConfig(
3440
+ const { diagnostics } = normalizeAndValidateConfig(
3285
3441
  { env: { ENV1: { r2_buckets: "BAD" } } } as unknown as RawConfig,
3286
3442
  undefined,
3287
3443
  { env: "ENV1" }
3288
3444
  );
3289
3445
 
3290
- expect(config).toEqual(
3291
- expect.not.objectContaining({ r2_buckets: expect.anything })
3292
- );
3293
3446
  expect(diagnostics.hasWarnings()).toBe(false);
3294
3447
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3295
3448
  "Processing wrangler configuration:
@@ -3300,15 +3453,12 @@ describe("normalizeAndValidateConfig()", () => {
3300
3453
  });
3301
3454
 
3302
3455
  it("should error if r2_buckets is a number", () => {
3303
- const { config, diagnostics } = normalizeAndValidateConfig(
3456
+ const { diagnostics } = normalizeAndValidateConfig(
3304
3457
  { env: { ENV1: { r2_buckets: 999 } } } as unknown as RawConfig,
3305
3458
  undefined,
3306
3459
  { env: "ENV1" }
3307
3460
  );
3308
3461
 
3309
- expect(config).toEqual(
3310
- expect.not.objectContaining({ r2_buckets: expect.anything })
3311
- );
3312
3462
  expect(diagnostics.hasWarnings()).toBe(false);
3313
3463
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3314
3464
  "Processing wrangler configuration:
@@ -3319,15 +3469,12 @@ describe("normalizeAndValidateConfig()", () => {
3319
3469
  });
3320
3470
 
3321
3471
  it("should error if r2_buckets is null", () => {
3322
- const { config, diagnostics } = normalizeAndValidateConfig(
3472
+ const { diagnostics } = normalizeAndValidateConfig(
3323
3473
  { env: { ENV1: { r2_buckets: null } } } as unknown as RawConfig,
3324
3474
  undefined,
3325
3475
  { env: "ENV1" }
3326
3476
  );
3327
3477
 
3328
- expect(config).toEqual(
3329
- expect.not.objectContaining({ r2_buckets: expect.anything })
3330
- );
3331
3478
  expect(diagnostics.hasWarnings()).toBe(false);
3332
3479
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3333
3480
  "Processing wrangler configuration:
@@ -3338,7 +3485,7 @@ describe("normalizeAndValidateConfig()", () => {
3338
3485
  });
3339
3486
 
3340
3487
  it("should error if r2_buckets.bindings are not valid", () => {
3341
- const { config, diagnostics } = normalizeAndValidateConfig(
3488
+ const { diagnostics } = normalizeAndValidateConfig(
3342
3489
  {
3343
3490
  env: {
3344
3491
  ENV1: {
@@ -3359,11 +3506,6 @@ describe("normalizeAndValidateConfig()", () => {
3359
3506
  { env: "ENV1" }
3360
3507
  );
3361
3508
 
3362
- expect(config).toEqual(
3363
- expect.not.objectContaining({
3364
- r2_buckets: { bindings: expect.anything },
3365
- })
3366
- );
3367
3509
  expect(diagnostics.hasWarnings()).toBe(false);
3368
3510
  expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3369
3511
  "Processing wrangler configuration:
@@ -3379,17 +3521,122 @@ describe("normalizeAndValidateConfig()", () => {
3379
3521
  });
3380
3522
  });
3381
3523
 
3524
+ describe("[analytics_engine_datasets]", () => {
3525
+ it("should error if analytics_engine_datasets is an object", () => {
3526
+ const { diagnostics } = normalizeAndValidateConfig(
3527
+ {
3528
+ env: { ENV1: { analytics_engine_datasets: {} } },
3529
+ } as unknown as RawConfig,
3530
+ undefined,
3531
+ { env: "ENV1" }
3532
+ );
3533
+
3534
+ expect(diagnostics.hasWarnings()).toBe(false);
3535
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3536
+ "Processing wrangler configuration:
3537
+
3538
+ - \\"env.ENV1\\" environment configuration
3539
+ - The field \\"env.ENV1.analytics_engine_datasets\\" should be an array but got {}."
3540
+ `);
3541
+ });
3542
+
3543
+ it("should error if analytics_engine_datasets is a string", () => {
3544
+ const { diagnostics } = normalizeAndValidateConfig(
3545
+ {
3546
+ env: { ENV1: { analytics_engine_datasets: "BAD" } },
3547
+ } as unknown as RawConfig,
3548
+ undefined,
3549
+ { env: "ENV1" }
3550
+ );
3551
+
3552
+ expect(diagnostics.hasWarnings()).toBe(false);
3553
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3554
+ "Processing wrangler configuration:
3555
+
3556
+ - \\"env.ENV1\\" environment configuration
3557
+ - The field \\"env.ENV1.analytics_engine_datasets\\" should be an array but got \\"BAD\\"."
3558
+ `);
3559
+ });
3560
+
3561
+ it("should error if analytics_engine_datasets is a number", () => {
3562
+ const { diagnostics } = normalizeAndValidateConfig(
3563
+ {
3564
+ env: { ENV1: { analytics_engine_datasets: 999 } },
3565
+ } as unknown as RawConfig,
3566
+ undefined,
3567
+ { env: "ENV1" }
3568
+ );
3569
+
3570
+ expect(diagnostics.hasWarnings()).toBe(false);
3571
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3572
+ "Processing wrangler configuration:
3573
+
3574
+ - \\"env.ENV1\\" environment configuration
3575
+ - The field \\"env.ENV1.analytics_engine_datasets\\" should be an array but got 999."
3576
+ `);
3577
+ });
3578
+
3579
+ it("should error if analytics_engine_datasets is null", () => {
3580
+ const { diagnostics } = normalizeAndValidateConfig(
3581
+ {
3582
+ env: { ENV1: { analytics_engine_datasets: null } },
3583
+ } as unknown as RawConfig,
3584
+ undefined,
3585
+ { env: "ENV1" }
3586
+ );
3587
+
3588
+ expect(diagnostics.hasWarnings()).toBe(false);
3589
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3590
+ "Processing wrangler configuration:
3591
+
3592
+ - \\"env.ENV1\\" environment configuration
3593
+ - The field \\"env.ENV1.analytics_engine_datasets\\" should be an array but got null."
3594
+ `);
3595
+ });
3596
+
3597
+ it("should error if analytics_engine_datasets.bindings are not valid", () => {
3598
+ const { diagnostics } = normalizeAndValidateConfig(
3599
+ {
3600
+ env: {
3601
+ ENV1: {
3602
+ analytics_engine_datasets: [
3603
+ {},
3604
+ { binding: 2333, dataset: 2444 },
3605
+ {
3606
+ binding: "AE_BINDING_2",
3607
+ dataset: 2555,
3608
+ },
3609
+ { binding: "AE_BINDING_1", dataset: "" },
3610
+ ],
3611
+ },
3612
+ },
3613
+ } as unknown as RawConfig,
3614
+ undefined,
3615
+ { env: "ENV1" }
3616
+ );
3617
+
3618
+ expect(diagnostics.hasWarnings()).toBe(false);
3619
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
3620
+ "Processing wrangler configuration:
3621
+
3622
+ - \\"env.ENV1\\" environment configuration
3623
+ - \\"env.ENV1.analytics_engine_datasets[0]\\" bindings should have a string \\"binding\\" field but got {}.
3624
+ - \\"env.ENV1.analytics_engine_datasets[1]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2333,\\"dataset\\":2444}.
3625
+ - \\"env.ENV1.analytics_engine_datasets[1]\\" bindings should, optionally, have a string \\"dataset\\" field but got {\\"binding\\":2333,\\"dataset\\":2444}.
3626
+ - \\"env.ENV1.analytics_engine_datasets[2]\\" bindings should, optionally, have a string \\"dataset\\" field but got {\\"binding\\":\\"AE_BINDING_2\\",\\"dataset\\":2555}.
3627
+ - \\"env.ENV1.analytics_engine_datasets[3]\\" bindings should, optionally, have a string \\"dataset\\" field but got {\\"binding\\":\\"AE_BINDING_1\\",\\"dataset\\":\\"\\"}."
3628
+ `);
3629
+ });
3630
+ });
3631
+
3382
3632
  describe("[unsafe.bindings]", () => {
3383
3633
  it("should error if unsafe is an array", () => {
3384
- const { config, diagnostics } = normalizeAndValidateConfig(
3634
+ const { diagnostics } = normalizeAndValidateConfig(
3385
3635
  { env: { ENV1: { unsafe: [] } } } as unknown as RawConfig,
3386
3636
  undefined,
3387
3637
  { env: "ENV1" }
3388
3638
  );
3389
3639
 
3390
- expect(config).toEqual(
3391
- expect.not.objectContaining({ unsafe: expect.anything })
3392
- );
3393
3640
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3394
3641
  "Processing wrangler configuration:
3395
3642
 
@@ -3405,15 +3652,12 @@ describe("normalizeAndValidateConfig()", () => {
3405
3652
  });
3406
3653
 
3407
3654
  it("should error if unsafe is a string", () => {
3408
- const { config, diagnostics } = normalizeAndValidateConfig(
3655
+ const { diagnostics } = normalizeAndValidateConfig(
3409
3656
  { env: { ENV1: { unsafe: "BAD" } } } as unknown as RawConfig,
3410
3657
  undefined,
3411
3658
  { env: "ENV1" }
3412
3659
  );
3413
3660
 
3414
- expect(config).toEqual(
3415
- expect.not.objectContaining({ unsafe: expect.anything })
3416
- );
3417
3661
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3418
3662
  "Processing wrangler configuration:
3419
3663
 
@@ -3429,15 +3673,12 @@ describe("normalizeAndValidateConfig()", () => {
3429
3673
  });
3430
3674
 
3431
3675
  it("should error if unsafe is a number", () => {
3432
- const { config, diagnostics } = normalizeAndValidateConfig(
3676
+ const { diagnostics } = normalizeAndValidateConfig(
3433
3677
  { env: { ENV1: { unsafe: 999 } } } as unknown as RawConfig,
3434
3678
  undefined,
3435
3679
  { env: "ENV1" }
3436
3680
  );
3437
3681
 
3438
- expect(config).toEqual(
3439
- expect.not.objectContaining({ unsafe: expect.anything })
3440
- );
3441
3682
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3442
3683
  "Processing wrangler configuration:
3443
3684
 
@@ -3453,15 +3694,12 @@ describe("normalizeAndValidateConfig()", () => {
3453
3694
  });
3454
3695
 
3455
3696
  it("should error if unsafe is null", () => {
3456
- const { config, diagnostics } = normalizeAndValidateConfig(
3697
+ const { diagnostics } = normalizeAndValidateConfig(
3457
3698
  { env: { ENV1: { unsafe: null } } } as unknown as RawConfig,
3458
3699
  undefined,
3459
3700
  { env: "ENV1" }
3460
3701
  );
3461
3702
 
3462
- expect(config).toEqual(
3463
- expect.not.objectContaining({ unsafe: expect.anything })
3464
- );
3465
3703
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3466
3704
  "Processing wrangler configuration:
3467
3705
 
@@ -3477,15 +3715,12 @@ describe("normalizeAndValidateConfig()", () => {
3477
3715
  });
3478
3716
 
3479
3717
  it("should error if unsafe.bindings is not defined", () => {
3480
- const { config, diagnostics } = normalizeAndValidateConfig(
3718
+ const { diagnostics } = normalizeAndValidateConfig(
3481
3719
  { env: { ENV1: { unsafe: {} } } } as unknown as RawConfig,
3482
3720
  undefined,
3483
3721
  { env: "ENV1" }
3484
3722
  );
3485
3723
 
3486
- expect(config).toEqual(
3487
- expect.not.objectContaining({ unsafe: expect.anything })
3488
- );
3489
3724
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3490
3725
  "Processing wrangler configuration:
3491
3726
 
@@ -3501,7 +3736,7 @@ describe("normalizeAndValidateConfig()", () => {
3501
3736
  });
3502
3737
 
3503
3738
  it("should error if unsafe.bindings is an object", () => {
3504
- const { config, diagnostics } = normalizeAndValidateConfig(
3739
+ const { diagnostics } = normalizeAndValidateConfig(
3505
3740
  {
3506
3741
  env: { ENV1: { unsafe: { bindings: {} } } },
3507
3742
  } as unknown as RawConfig,
@@ -3509,11 +3744,6 @@ describe("normalizeAndValidateConfig()", () => {
3509
3744
  { env: "ENV1" }
3510
3745
  );
3511
3746
 
3512
- expect(config).toEqual(
3513
- expect.not.objectContaining({
3514
- unsafe: { bindings: expect.anything },
3515
- })
3516
- );
3517
3747
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3518
3748
  "Processing wrangler configuration:
3519
3749
 
@@ -3529,7 +3759,7 @@ describe("normalizeAndValidateConfig()", () => {
3529
3759
  });
3530
3760
 
3531
3761
  it("should error if unsafe.bindings is a string", () => {
3532
- const { config, diagnostics } = normalizeAndValidateConfig(
3762
+ const { diagnostics } = normalizeAndValidateConfig(
3533
3763
  {
3534
3764
  env: { ENV1: { unsafe: { bindings: "BAD" } } },
3535
3765
  } as unknown as RawConfig,
@@ -3537,11 +3767,6 @@ describe("normalizeAndValidateConfig()", () => {
3537
3767
  { env: "ENV1" }
3538
3768
  );
3539
3769
 
3540
- expect(config).toEqual(
3541
- expect.not.objectContaining({
3542
- unsafe: { bindings: expect.anything },
3543
- })
3544
- );
3545
3770
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3546
3771
  "Processing wrangler configuration:
3547
3772
 
@@ -3557,7 +3782,7 @@ describe("normalizeAndValidateConfig()", () => {
3557
3782
  });
3558
3783
 
3559
3784
  it("should error if unsafe.bindings is a number", () => {
3560
- const { config, diagnostics } = normalizeAndValidateConfig(
3785
+ const { diagnostics } = normalizeAndValidateConfig(
3561
3786
  {
3562
3787
  env: { ENV1: { unsafe: { bindings: 999 } } },
3563
3788
  } as unknown as RawConfig,
@@ -3565,11 +3790,6 @@ describe("normalizeAndValidateConfig()", () => {
3565
3790
  { env: "ENV1" }
3566
3791
  );
3567
3792
 
3568
- expect(config).toEqual(
3569
- expect.not.objectContaining({
3570
- unsafe: { bindings: expect.anything },
3571
- })
3572
- );
3573
3793
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3574
3794
  "Processing wrangler configuration:
3575
3795
 
@@ -3585,7 +3805,7 @@ describe("normalizeAndValidateConfig()", () => {
3585
3805
  });
3586
3806
 
3587
3807
  it("should error if unsafe.bindings is null", () => {
3588
- const { config, diagnostics } = normalizeAndValidateConfig(
3808
+ const { diagnostics } = normalizeAndValidateConfig(
3589
3809
  {
3590
3810
  env: { ENV1: { unsafe: { bindings: null } } },
3591
3811
  } as unknown as RawConfig,
@@ -3593,11 +3813,6 @@ describe("normalizeAndValidateConfig()", () => {
3593
3813
  { env: "ENV1" }
3594
3814
  );
3595
3815
 
3596
- expect(config).toEqual(
3597
- expect.not.objectContaining({
3598
- unsafe: { bindings: expect.anything },
3599
- })
3600
- );
3601
3816
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3602
3817
  "Processing wrangler configuration:
3603
3818
 
@@ -3613,7 +3828,7 @@ describe("normalizeAndValidateConfig()", () => {
3613
3828
  });
3614
3829
 
3615
3830
  it("should error if unsafe.bindings are not valid", () => {
3616
- const { config, diagnostics } = normalizeAndValidateConfig(
3831
+ const { diagnostics } = normalizeAndValidateConfig(
3617
3832
  {
3618
3833
  env: {
3619
3834
  ENV1: {
@@ -3636,11 +3851,6 @@ describe("normalizeAndValidateConfig()", () => {
3636
3851
  { env: "ENV1" }
3637
3852
  );
3638
3853
 
3639
- expect(config).toEqual(
3640
- expect.not.objectContaining({
3641
- durable_objects: { bindings: expect.anything },
3642
- })
3643
- );
3644
3854
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3645
3855
  "Processing wrangler configuration:
3646
3856
 
@@ -3670,6 +3880,7 @@ describe("normalizeAndValidateConfig()", () => {
3670
3880
  it("should remove and warn about deprecated properties", () => {
3671
3881
  const environment: RawEnvironment = {
3672
3882
  zone_id: "ZONE_ID",
3883
+ "kv-namespaces": "BAD_KV_NAMESPACE",
3673
3884
  experimental_services: [
3674
3885
  {
3675
3886
  name: "mock-name",
@@ -3695,14 +3906,16 @@ describe("normalizeAndValidateConfig()", () => {
3695
3906
  expect(diagnostics.hasErrors()).toBe(false);
3696
3907
  expect(diagnostics.hasWarnings()).toBe(true);
3697
3908
  expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
3698
- "Processing wrangler configuration:
3909
+ "Processing wrangler configuration:
3699
3910
 
3700
- - \\"env.ENV1\\" environment configuration
3701
- - Deprecation: \\"zone_id\\":
3702
- This is unnecessary since we can deduce this from routes directly.
3703
- - Deprecation: \\"experimental_services\\":
3704
- The \\"experimental_services\\" field is no longer supported. Simply rename the [experimental_services] field to [services]."
3705
- `);
3911
+ - \\"env.ENV1\\" environment configuration
3912
+ - Deprecation: \\"kv-namespaces\\":
3913
+ The \\"kv-namespaces\\" field is no longer supported, please rename to \\"kv_namespaces\\"
3914
+ - Deprecation: \\"zone_id\\":
3915
+ This is unnecessary since we can deduce this from routes directly.
3916
+ - Deprecation: \\"experimental_services\\":
3917
+ The \\"experimental_services\\" field is no longer supported. Simply rename the [experimental_services] field to [services]."
3918
+ `);
3706
3919
  });
3707
3920
  });
3708
3921