wrangler 2.0.2 → 2.0.6

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.
@@ -48,10 +48,7 @@ describe("wrangler", () => {
48
48
  );
49
49
  expect(std.out).toMatchInlineSnapshot(`
50
50
  "
51
- "
52
- `);
53
- expect(std.err).toMatchInlineSnapshot(`
54
- "wrangler kv:namespace create <namespace>
51
+ wrangler kv:namespace create <namespace>
55
52
 
56
53
  Create a new namespace
57
54
 
@@ -59,15 +56,16 @@ describe("wrangler", () => {
59
56
  namespace The name of the new namespace [string] [required]
60
57
 
61
58
  Flags:
62
- -c, --config Path to .toml configuration file [string]
63
- -h, --help Show help [boolean]
64
- -v, --version Show version number [boolean]
65
- --legacy-env Use legacy environments [boolean]
59
+ -c, --config Path to .toml configuration file [string]
60
+ -h, --help Show help [boolean]
61
+ -v, --version Show version number [boolean]
66
62
 
67
63
  Options:
68
64
  -e, --env Perform on a specific environment [string]
69
- --preview Interact with a preview namespace [boolean]
70
- X [ERROR] Not enough non-option arguments: got 0, need at least 1
65
+ --preview Interact with a preview namespace [boolean]"
66
+ `);
67
+ expect(std.err).toMatchInlineSnapshot(`
68
+ "X [ERROR] Not enough non-option arguments: got 0, need at least 1
71
69
 
72
70
  "
73
71
  `);
@@ -81,10 +79,7 @@ describe("wrangler", () => {
81
79
  );
82
80
  expect(std.out).toMatchInlineSnapshot(`
83
81
  "
84
- "
85
- `);
86
- expect(std.err).toMatchInlineSnapshot(`
87
- "wrangler kv:namespace create <namespace>
82
+ wrangler kv:namespace create <namespace>
88
83
 
89
84
  Create a new namespace
90
85
 
@@ -92,15 +87,16 @@ describe("wrangler", () => {
92
87
  namespace The name of the new namespace [string] [required]
93
88
 
94
89
  Flags:
95
- -c, --config Path to .toml configuration file [string]
96
- -h, --help Show help [boolean]
97
- -v, --version Show version number [boolean]
98
- --legacy-env Use legacy environments [boolean]
90
+ -c, --config Path to .toml configuration file [string]
91
+ -h, --help Show help [boolean]
92
+ -v, --version Show version number [boolean]
99
93
 
100
94
  Options:
101
95
  -e, --env Perform on a specific environment [string]
102
- --preview Interact with a preview namespace [boolean]
103
- X [ERROR] Unknown arguments: def, ghi
96
+ --preview Interact with a preview namespace [boolean]"
97
+ `);
98
+ expect(std.err).toMatchInlineSnapshot(`
99
+ "X [ERROR] Unknown arguments: def, ghi
104
100
 
105
101
  "
106
102
  `);
@@ -115,10 +111,7 @@ describe("wrangler", () => {
115
111
 
116
112
  expect(std.out).toMatchInlineSnapshot(`
117
113
  "
118
- "
119
- `);
120
- expect(std.err).toMatchInlineSnapshot(`
121
- "wrangler kv:namespace create <namespace>
114
+ wrangler kv:namespace create <namespace>
122
115
 
123
116
  Create a new namespace
124
117
 
@@ -126,15 +119,16 @@ describe("wrangler", () => {
126
119
  namespace The name of the new namespace [string] [required]
127
120
 
128
121
  Flags:
129
- -c, --config Path to .toml configuration file [string]
130
- -h, --help Show help [boolean]
131
- -v, --version Show version number [boolean]
132
- --legacy-env Use legacy environments [boolean]
122
+ -c, --config Path to .toml configuration file [string]
123
+ -h, --help Show help [boolean]
124
+ -v, --version Show version number [boolean]
133
125
 
134
126
  Options:
135
127
  -e, --env Perform on a specific environment [string]
136
- --preview Interact with a preview namespace [boolean]
137
- X [ERROR] The namespace binding name \\"abc-def\\" is invalid. It can only have alphanumeric and _ characters, and cannot begin with a number.
128
+ --preview Interact with a preview namespace [boolean]"
129
+ `);
130
+ expect(std.err).toMatchInlineSnapshot(`
131
+ "X [ERROR] The namespace binding name \\"abc-def\\" is invalid. It can only have alphanumeric and _ characters, and cannot begin with a number.
138
132
 
139
133
  "
140
134
  `);
@@ -286,22 +280,7 @@ describe("wrangler", () => {
286
280
  A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."
287
281
  `);
288
282
  expect(std.err).toMatchInlineSnapshot(`
289
- "wrangler kv:namespace delete
290
-
291
- Deletes a given namespace.
292
-
293
- Flags:
294
- -c, --config Path to .toml configuration file [string]
295
- -h, --help Show help [boolean]
296
- -v, --version Show version number [boolean]
297
- --legacy-env Use legacy environments [boolean]
298
-
299
- Options:
300
- --binding The name of the namespace to delete [string]
301
- --namespace-id The id of the namespace to delete [string]
302
- -e, --env Perform on a specific environment [string]
303
- --preview Interact with a preview namespace [boolean]
304
- X [ERROR] Not able to delete namespace.
283
+ "X [ERROR] Not able to delete namespace.
305
284
 
306
285
  A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".
307
286
 
@@ -385,6 +364,21 @@ describe("wrangler", () => {
385
364
  expect(std.err).toMatchInlineSnapshot(`""`);
386
365
  });
387
366
 
367
+ it("should encode the key in the api request to put a value", async () => {
368
+ const requests = mockKeyPutRequest("DS9", {
369
+ key: "%2Fmy-key",
370
+ value: "my-value",
371
+ });
372
+
373
+ await runWrangler("kv:key put /my-key my-value --namespace-id DS9");
374
+
375
+ expect(requests.count).toEqual(1);
376
+ expect(std.out).toMatchInlineSnapshot(
377
+ `"Writing the value \\"my-value\\" to key \\"/my-key\\" on namespace DS9."`
378
+ );
379
+ expect(std.err).toMatchInlineSnapshot(`""`);
380
+ });
381
+
388
382
  it("should put a key in a given namespace specified by binding", async () => {
389
383
  writeWranglerConfig();
390
384
  const requests = mockKeyPutRequest("bound-id", {
@@ -478,10 +472,7 @@ describe("wrangler", () => {
478
472
 
479
473
  expect(std.out).toMatchInlineSnapshot(`
480
474
  "
481
- "
482
- `);
483
- expect(std.err).toMatchInlineSnapshot(`
484
- "wrangler kv:key put <key> [value]
475
+ wrangler kv:key put <key> [value]
485
476
 
486
477
  Writes a single key/value pair to the given namespace.
487
478
 
@@ -490,10 +481,9 @@ describe("wrangler", () => {
490
481
  value The value to write [string]
491
482
 
492
483
  Flags:
493
- -c, --config Path to .toml configuration file [string]
494
- -h, --help Show help [boolean]
495
- -v, --version Show version number [boolean]
496
- --legacy-env Use legacy environments [boolean]
484
+ -c, --config Path to .toml configuration file [string]
485
+ -h, --help Show help [boolean]
486
+ -v, --version Show version number [boolean]
497
487
 
498
488
  Options:
499
489
  --binding The binding of the namespace to write to [string]
@@ -502,8 +492,10 @@ describe("wrangler", () => {
502
492
  --preview Interact with a preview namespace [boolean]
503
493
  --ttl Time for which the entries should be visible [number]
504
494
  --expiration Time since the UNIX epoch after which the entry expires [number]
505
- --path Read value from the file at a given path [string]
506
- X [ERROR] Not enough non-option arguments: got 0, need at least 1
495
+ --path Read value from the file at a given path [string]"
496
+ `);
497
+ expect(std.err).toMatchInlineSnapshot(`
498
+ "X [ERROR] Not enough non-option arguments: got 0, need at least 1
507
499
 
508
500
  "
509
501
  `);
@@ -518,10 +510,7 @@ describe("wrangler", () => {
518
510
 
519
511
  expect(std.out).toMatchInlineSnapshot(`
520
512
  "
521
- "
522
- `);
523
- expect(std.err).toMatchInlineSnapshot(`
524
- "wrangler kv:key put <key> [value]
513
+ wrangler kv:key put <key> [value]
525
514
 
526
515
  Writes a single key/value pair to the given namespace.
527
516
 
@@ -530,10 +519,9 @@ describe("wrangler", () => {
530
519
  value The value to write [string]
531
520
 
532
521
  Flags:
533
- -c, --config Path to .toml configuration file [string]
534
- -h, --help Show help [boolean]
535
- -v, --version Show version number [boolean]
536
- --legacy-env Use legacy environments [boolean]
522
+ -c, --config Path to .toml configuration file [string]
523
+ -h, --help Show help [boolean]
524
+ -v, --version Show version number [boolean]
537
525
 
538
526
  Options:
539
527
  --binding The binding of the namespace to write to [string]
@@ -542,8 +530,10 @@ describe("wrangler", () => {
542
530
  --preview Interact with a preview namespace [boolean]
543
531
  --ttl Time for which the entries should be visible [number]
544
532
  --expiration Time since the UNIX epoch after which the entry expires [number]
545
- --path Read value from the file at a given path [string]
546
- X [ERROR] Exactly one of the arguments binding and namespace-id is required
533
+ --path Read value from the file at a given path [string]"
534
+ `);
535
+ expect(std.err).toMatchInlineSnapshot(`
536
+ "X [ERROR] Exactly one of the arguments binding and namespace-id is required
547
537
 
548
538
  "
549
539
  `);
@@ -558,10 +548,7 @@ describe("wrangler", () => {
558
548
 
559
549
  expect(std.out).toMatchInlineSnapshot(`
560
550
  "
561
- "
562
- `);
563
- expect(std.err).toMatchInlineSnapshot(`
564
- "wrangler kv:key put <key> [value]
551
+ wrangler kv:key put <key> [value]
565
552
 
566
553
  Writes a single key/value pair to the given namespace.
567
554
 
@@ -570,10 +557,9 @@ describe("wrangler", () => {
570
557
  value The value to write [string]
571
558
 
572
559
  Flags:
573
- -c, --config Path to .toml configuration file [string]
574
- -h, --help Show help [boolean]
575
- -v, --version Show version number [boolean]
576
- --legacy-env Use legacy environments [boolean]
560
+ -c, --config Path to .toml configuration file [string]
561
+ -h, --help Show help [boolean]
562
+ -v, --version Show version number [boolean]
577
563
 
578
564
  Options:
579
565
  --binding The binding of the namespace to write to [string]
@@ -582,8 +568,10 @@ describe("wrangler", () => {
582
568
  --preview Interact with a preview namespace [boolean]
583
569
  --ttl Time for which the entries should be visible [number]
584
570
  --expiration Time since the UNIX epoch after which the entry expires [number]
585
- --path Read value from the file at a given path [string]
586
- X [ERROR] Arguments binding and namespace-id are mutually exclusive
571
+ --path Read value from the file at a given path [string]"
572
+ `);
573
+ expect(std.err).toMatchInlineSnapshot(`
574
+ "X [ERROR] Arguments binding and namespace-id are mutually exclusive
587
575
 
588
576
  "
589
577
  `);
@@ -598,10 +586,7 @@ describe("wrangler", () => {
598
586
 
599
587
  expect(std.out).toMatchInlineSnapshot(`
600
588
  "
601
- "
602
- `);
603
- expect(std.err).toMatchInlineSnapshot(`
604
- "wrangler kv:key put <key> [value]
589
+ wrangler kv:key put <key> [value]
605
590
 
606
591
  Writes a single key/value pair to the given namespace.
607
592
 
@@ -610,10 +595,9 @@ describe("wrangler", () => {
610
595
  value The value to write [string]
611
596
 
612
597
  Flags:
613
- -c, --config Path to .toml configuration file [string]
614
- -h, --help Show help [boolean]
615
- -v, --version Show version number [boolean]
616
- --legacy-env Use legacy environments [boolean]
598
+ -c, --config Path to .toml configuration file [string]
599
+ -h, --help Show help [boolean]
600
+ -v, --version Show version number [boolean]
617
601
 
618
602
  Options:
619
603
  --binding The binding of the namespace to write to [string]
@@ -622,8 +606,10 @@ describe("wrangler", () => {
622
606
  --preview Interact with a preview namespace [boolean]
623
607
  --ttl Time for which the entries should be visible [number]
624
608
  --expiration Time since the UNIX epoch after which the entry expires [number]
625
- --path Read value from the file at a given path [string]
626
- X [ERROR] Exactly one of the arguments value and path is required
609
+ --path Read value from the file at a given path [string]"
610
+ `);
611
+ expect(std.err).toMatchInlineSnapshot(`
612
+ "X [ERROR] Exactly one of the arguments value and path is required
627
613
 
628
614
  "
629
615
  `);
@@ -638,10 +624,7 @@ describe("wrangler", () => {
638
624
 
639
625
  expect(std.out).toMatchInlineSnapshot(`
640
626
  "
641
- "
642
- `);
643
- expect(std.err).toMatchInlineSnapshot(`
644
- "wrangler kv:key put <key> [value]
627
+ wrangler kv:key put <key> [value]
645
628
 
646
629
  Writes a single key/value pair to the given namespace.
647
630
 
@@ -650,10 +633,9 @@ describe("wrangler", () => {
650
633
  value The value to write [string]
651
634
 
652
635
  Flags:
653
- -c, --config Path to .toml configuration file [string]
654
- -h, --help Show help [boolean]
655
- -v, --version Show version number [boolean]
656
- --legacy-env Use legacy environments [boolean]
636
+ -c, --config Path to .toml configuration file [string]
637
+ -h, --help Show help [boolean]
638
+ -v, --version Show version number [boolean]
657
639
 
658
640
  Options:
659
641
  --binding The binding of the namespace to write to [string]
@@ -662,8 +644,10 @@ describe("wrangler", () => {
662
644
  --preview Interact with a preview namespace [boolean]
663
645
  --ttl Time for which the entries should be visible [number]
664
646
  --expiration Time since the UNIX epoch after which the entry expires [number]
665
- --path Read value from the file at a given path [string]
666
- X [ERROR] Arguments value and path are mutually exclusive
647
+ --path Read value from the file at a given path [string]"
648
+ `);
649
+ expect(std.err).toMatchInlineSnapshot(`
650
+ "X [ERROR] Arguments value and path are mutually exclusive
667
651
 
668
652
  "
669
653
  `);
@@ -937,6 +921,20 @@ describe("wrangler", () => {
937
921
  expect(std.err).toMatchInlineSnapshot(`""`);
938
922
  });
939
923
 
924
+ it("should encode the key in the api request to get a value", async () => {
925
+ setMockFetchKVGetValue(
926
+ "some-account-id",
927
+ "some-namespace-id",
928
+ "%2Fmy%2Ckey",
929
+ "my-value"
930
+ );
931
+ await runWrangler(
932
+ "kv:key get /my,key --namespace-id some-namespace-id"
933
+ );
934
+ expect(std.out).toMatchInlineSnapshot(`"my-value"`);
935
+ expect(std.err).toMatchInlineSnapshot(`""`);
936
+ });
937
+
940
938
  it("should error if no key is provided", async () => {
941
939
  await expect(
942
940
  runWrangler("kv:key get")
@@ -945,10 +943,7 @@ describe("wrangler", () => {
945
943
  );
946
944
  expect(std.out).toMatchInlineSnapshot(`
947
945
  "
948
- "
949
- `);
950
- expect(std.err).toMatchInlineSnapshot(`
951
- "wrangler kv:key get <key>
946
+ wrangler kv:key get <key>
952
947
 
953
948
  Reads a single value by key from the given namespace.
954
949
 
@@ -956,17 +951,18 @@ describe("wrangler", () => {
956
951
  key The key value to get. [string] [required]
957
952
 
958
953
  Flags:
959
- -c, --config Path to .toml configuration file [string]
960
- -h, --help Show help [boolean]
961
- -v, --version Show version number [boolean]
962
- --legacy-env Use legacy environments [boolean]
954
+ -c, --config Path to .toml configuration file [string]
955
+ -h, --help Show help [boolean]
956
+ -v, --version Show version number [boolean]
963
957
 
964
958
  Options:
965
959
  --binding The name of the namespace to get from [string]
966
960
  --namespace-id The id of the namespace to get from [string]
967
961
  -e, --env Perform on a specific environment [string]
968
- --preview Interact with a preview namespace [boolean] [default: false]
969
- X [ERROR] Not enough non-option arguments: got 0, need at least 1
962
+ --preview Interact with a preview namespace [boolean] [default: false]"
963
+ `);
964
+ expect(std.err).toMatchInlineSnapshot(`
965
+ "X [ERROR] Not enough non-option arguments: got 0, need at least 1
970
966
 
971
967
  "
972
968
  `);
@@ -980,10 +976,7 @@ describe("wrangler", () => {
980
976
  );
981
977
  expect(std.out).toMatchInlineSnapshot(`
982
978
  "
983
- "
984
- `);
985
- expect(std.err).toMatchInlineSnapshot(`
986
- "wrangler kv:key get <key>
979
+ wrangler kv:key get <key>
987
980
 
988
981
  Reads a single value by key from the given namespace.
989
982
 
@@ -991,17 +984,18 @@ describe("wrangler", () => {
991
984
  key The key value to get. [string] [required]
992
985
 
993
986
  Flags:
994
- -c, --config Path to .toml configuration file [string]
995
- -h, --help Show help [boolean]
996
- -v, --version Show version number [boolean]
997
- --legacy-env Use legacy environments [boolean]
987
+ -c, --config Path to .toml configuration file [string]
988
+ -h, --help Show help [boolean]
989
+ -v, --version Show version number [boolean]
998
990
 
999
991
  Options:
1000
992
  --binding The name of the namespace to get from [string]
1001
993
  --namespace-id The id of the namespace to get from [string]
1002
994
  -e, --env Perform on a specific environment [string]
1003
- --preview Interact with a preview namespace [boolean] [default: false]
1004
- X [ERROR] Exactly one of the arguments binding and namespace-id is required
995
+ --preview Interact with a preview namespace [boolean] [default: false]"
996
+ `);
997
+ expect(std.err).toMatchInlineSnapshot(`
998
+ "X [ERROR] Exactly one of the arguments binding and namespace-id is required
1005
999
 
1006
1000
  "
1007
1001
  `);
@@ -1016,10 +1010,7 @@ describe("wrangler", () => {
1016
1010
 
1017
1011
  expect(std.out).toMatchInlineSnapshot(`
1018
1012
  "
1019
- "
1020
- `);
1021
- expect(std.err).toMatchInlineSnapshot(`
1022
- "wrangler kv:key get <key>
1013
+ wrangler kv:key get <key>
1023
1014
 
1024
1015
  Reads a single value by key from the given namespace.
1025
1016
 
@@ -1027,17 +1018,18 @@ describe("wrangler", () => {
1027
1018
  key The key value to get. [string] [required]
1028
1019
 
1029
1020
  Flags:
1030
- -c, --config Path to .toml configuration file [string]
1031
- -h, --help Show help [boolean]
1032
- -v, --version Show version number [boolean]
1033
- --legacy-env Use legacy environments [boolean]
1021
+ -c, --config Path to .toml configuration file [string]
1022
+ -h, --help Show help [boolean]
1023
+ -v, --version Show version number [boolean]
1034
1024
 
1035
1025
  Options:
1036
1026
  --binding The name of the namespace to get from [string]
1037
1027
  --namespace-id The id of the namespace to get from [string]
1038
1028
  -e, --env Perform on a specific environment [string]
1039
- --preview Interact with a preview namespace [boolean] [default: false]
1040
- X [ERROR] Arguments binding and namespace-id are mutually exclusive
1029
+ --preview Interact with a preview namespace [boolean] [default: false]"
1030
+ `);
1031
+ expect(std.err).toMatchInlineSnapshot(`
1032
+ "X [ERROR] Arguments binding and namespace-id are mutually exclusive
1041
1033
 
1042
1034
  "
1043
1035
  `);
@@ -1090,6 +1082,16 @@ describe("wrangler", () => {
1090
1082
  expect(requests.count).toEqual(1);
1091
1083
  });
1092
1084
 
1085
+ it("should encode the key in the api request to delete a value", async () => {
1086
+ const requests = mockDeleteRequest("voyager", "%2FNCC-74656");
1087
+ await runWrangler(`kv:key delete --namespace-id voyager /NCC-74656`);
1088
+ expect(requests.count).toEqual(1);
1089
+ expect(std.out).toMatchInlineSnapshot(
1090
+ `"Deleting the key \\"/NCC-74656\\" on namespace voyager."`
1091
+ );
1092
+ expect(std.err).toMatchInlineSnapshot(`""`);
1093
+ });
1094
+
1093
1095
  it("should delete a key in a namespace specified by binding name", async () => {
1094
1096
  writeWranglerConfig();
1095
1097
  const requests = mockDeleteRequest("bound-id", "someKey");
@@ -1235,7 +1237,25 @@ describe("wrangler", () => {
1235
1237
  "a string",
1236
1238
  { key: "someKey" },
1237
1239
  { value: "someValue" },
1240
+ // add a valid object here to make sure it's not included
1241
+ { key: "someKey1", value: "someValue1" },
1242
+ // this one will only add a warning
1238
1243
  { key: "someKey1", value: "someValue1", invalid: true },
1244
+ // back to the invalid ones
1245
+ { key: 123, value: "somevalue" },
1246
+ { key: "somekey", value: 123 },
1247
+ { key: "someKey1", value: "someValue1", expiration: "string" },
1248
+ { key: "someKey1", value: "someValue1", expiration_ttl: "string" },
1249
+ {
1250
+ key: 123,
1251
+ value: {
1252
+ a: {
1253
+ nested: "object",
1254
+ },
1255
+ },
1256
+ },
1257
+ { key: "someKey1", value: "someValue1", metadata: 123 },
1258
+ { key: "someKey1", value: "someValue1", base64: "string" },
1239
1259
  ];
1240
1260
  writeFileSync("./keys.json", JSON.stringify(keyValues));
1241
1261
  await expect(
@@ -1253,10 +1273,17 @@ describe("wrangler", () => {
1253
1273
  base64?: boolean;
1254
1274
  }
1255
1275
 
1256
- The item at index 0 is type: \\"number\\" - 123
1257
- The item at index 1 is type: \\"string\\" - \\"a string\\"
1276
+ The item at index 0 is 123
1277
+ The item at index 1 is \\"a string\\"
1258
1278
  The item at index 2 is {\\"key\\":\\"someKey\\"}
1259
- The item at index 3 is {\\"value\\":\\"someValue\\"}"
1279
+ The item at index 3 is {\\"value\\":\\"someValue\\"}
1280
+ The item at index 6 is {\\"key\\":123,\\"value\\":\\"somevalue\\"}
1281
+ The item at index 7 is {\\"key\\":\\"somekey\\",\\"value\\":123}
1282
+ The item at index 8 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"expiration\\":\\"string\\"}
1283
+ The item at index 9 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"expiration_ttl\\":\\"string\\"}
1284
+ The item at index 10 is {\\"key\\":123,\\"value\\":{\\"a\\":{\\"nested\\":\\"object\\"}}}
1285
+ The item at index 11 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"metadata\\":123}
1286
+ The item at index 12 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"base64\\":\\"string\\"}"
1260
1287
  `);
1261
1288
 
1262
1289
  expect(std.out).toMatchInlineSnapshot(`
@@ -1266,7 +1293,7 @@ describe("wrangler", () => {
1266
1293
  expect(std.warn).toMatchInlineSnapshot(`
1267
1294
  "▲ [WARNING] Unexpected key-value properties in \\"keys.json\\".
1268
1295
 
1269
- The item at index 4 contains unexpected properties: [\\"invalid\\"].
1296
+ The item at index 5 contains unexpected properties: [\\"invalid\\"].
1270
1297
 
1271
1298
  "
1272
1299
  `);
@@ -1,4 +1,4 @@
1
- import { writeFileSync } from "node:fs";
1
+ import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { mockAccountId, mockApiToken } from "./helpers/mock-account-id";
3
3
  import { setMockResponse, unsetAllMocks } from "./helpers/mock-cfetch";
4
4
  import { mockConsoleMethods } from "./helpers/mock-console";
@@ -24,16 +24,15 @@ describe("pages", () => {
24
24
  ⚡️ Configure Cloudflare Pages
25
25
 
26
26
  Commands:
27
- wrangler pages dev [directory] [-- command] 🧑‍💻 Develop your full-stack Pages application locally
28
- wrangler pages project ⚡️ Interact with your Pages projects
29
- wrangler pages deployment 🚀 Interact with the deployments of a project
30
- wrangler pages publish [directory] 🆙 Publish a directory of static assets as a Pages deployment
27
+ wrangler pages dev [directory] [-- command..] 🧑‍💻 Develop your full-stack Pages application locally
28
+ wrangler pages project ⚡️ Interact with your Pages projects
29
+ wrangler pages deployment 🚀 Interact with the deployments of a project
30
+ wrangler pages publish [directory] 🆙 Publish a directory of static assets as a Pages deployment
31
31
 
32
32
  Flags:
33
- -c, --config Path to .toml configuration file [string]
34
- -h, --help Show help [boolean]
35
- -v, --version Show version number [boolean]
36
- --legacy-env Use legacy environments [boolean]
33
+ -c, --config Path to .toml configuration file [string]
34
+ -h, --help Show help [boolean]
35
+ -v, --version Show version number [boolean]
37
36
 
38
37
  🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose"
39
38
  `);
@@ -261,10 +260,9 @@ describe("pages", () => {
261
260
  directory The directory of static files to upload [string]
262
261
 
263
262
  Flags:
264
- -c, --config Path to .toml configuration file [string]
265
- -h, --help Show help [boolean]
266
- -v, --version Show version number [boolean]
267
- --legacy-env Use legacy environments [boolean]
263
+ -c, --config Path to .toml configuration file [string]
264
+ -h, --help Show help [boolean]
265
+ -v, --version Show version number [boolean]
268
266
 
269
267
  Options:
270
268
  --project-name The name of the project you want to deploy to [string]
@@ -325,5 +323,28 @@ describe("pages", () => {
325
323
  // ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
326
324
  // `);
327
325
  });
326
+
327
+ it("should not error when directory names contain periods and houses a extensionless file", async () => {
328
+ mkdirSync(".well-known");
329
+ writeFileSync(".well-known/foobar", "foobar");
330
+
331
+ setMockResponse(
332
+ "/accounts/:accountId/pages/projects/foo/file",
333
+ async () => ({
334
+ id: "7b764dacfd211bebd8077828a7ddefd7",
335
+ })
336
+ );
337
+
338
+ setMockResponse(
339
+ "/accounts/:accountId/pages/projects/foo/deployments",
340
+ async () => ({
341
+ url: "https://abcxyz.foo.pages.dev/",
342
+ })
343
+ );
344
+
345
+ await runWrangler("pages publish . --project-name=foo");
346
+
347
+ expect(std.err).toMatchInlineSnapshot(`""`);
348
+ });
328
349
  });
329
350
  });