@@ -142,6 +142,7 @@ describe.sequential("wrangler dev", () => {
142
142
msw . resetHandlers ( ) ;
143
143
spy . mockClear ( ) ;
144
144
setSpy . mockClear ( ) ;
145
+ logger . resetLoggerLevel ( ) ;
145
146
} ) ;
146
147
147
148
async function runWranglerUntilConfig (
@@ -1211,7 +1212,7 @@ describe.sequential("wrangler dev", () => {
1211
1212
) ;
1212
1213
expect ( std . out ) . toMatchInlineSnapshot ( `
1213
1214
"Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
1214
-
1215
+
1215
1216
Your worker has access to the following bindings:
1216
1217
- Durable Objects:
1217
1218
- NAME_1: CLASS_1
@@ -1304,7 +1305,7 @@ describe.sequential("wrangler dev", () => {
1304
1305
expect ( std . out ) . toMatchInlineSnapshot ( `
1305
1306
"Using vars defined in .dev.vars
1306
1307
Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
1307
-
1308
+
1308
1309
Your worker has access to the following bindings:
1309
1310
- Vars:
1310
1311
- VAR_1: \\"(hidden)\\"
@@ -1340,7 +1341,7 @@ describe.sequential("wrangler dev", () => {
1340
1341
expect ( std . out ) . toMatchInlineSnapshot ( `
1341
1342
"Using vars defined in .dev.vars.custom
1342
1343
Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
1343
-
1344
+
1344
1345
Your worker has access to the following bindings:
1345
1346
- Vars:
1346
1347
- CUSTOM_VAR: \\"(hidden)\\"
@@ -1356,64 +1357,6 @@ describe.sequential("wrangler dev", () => {
1356
1357
) . rejects . toThrowErrorMatchingInlineSnapshot (
1357
1358
`[Error: Not enough arguments following: site]`
1358
1359
) ;
1359
-
1360
- expect ( std ) . toMatchInlineSnapshot ( `
1361
- Object {
1362
- "debug": "",
1363
- "err": "[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough arguments following: site[0m
1364
-
1365
- ",
1366
- "info": "",
1367
- "out": "
1368
- wrangler dev [script]
1369
-
1370
- 👂 Start a local server for developing your Worker
1371
-
1372
- POSITIONALS
1373
- script The path to an entry point for your Worker [string]
1374
-
1375
- GLOBAL FLAGS
1376
- -c, --config Path to Wrangler configuration file [string]
1377
- -e, --env Environment to use for operations, and for selecting .env and .dev.vars files [string]
1378
- -h, --help Show help [boolean]
1379
- -v, --version Show version number [boolean]
1380
-
1381
- OPTIONS
1382
- --name Name of the Worker [string]
1383
- --compatibility-date Date to use for compatibility checks [string]
1384
- --compatibility-flags, --compatibility-flag Flags to use for compatibility checks [array]
1385
- --latest Use the latest version of the Workers runtime [boolean] [default: true]
1386
- --assets Static assets to be served. Replaces Workers Sites. [string]
1387
- --no-bundle Skip internal build steps and directly deploy script [boolean] [default: false]
1388
- --ip IP address to listen on [string]
1389
- --port Port to listen on [number]
1390
- --inspector-port Port for devtools to connect to [number]
1391
- --routes, --route Routes to upload [array]
1392
- --host Host to forward requests to, defaults to the zone of project [string]
1393
- --local-protocol Protocol to listen to requests on, defaults to http. [choices: \\"http\\", \\"https\\"]
1394
- --https-key-path Path to a custom certificate key [string]
1395
- --https-cert-path Path to a custom certificate [string]
1396
- --local-upstream Host to act as origin in local mode, defaults to dev.host or route [string]
1397
- --upstream-protocol Protocol to forward requests to host on, defaults to https. [choices: \\"http\\", \\"https\\"]
1398
- --var A key-value pair to be injected into the script as a variable [array]
1399
- --define A key-value pair to be substituted in the script [array]
1400
- --alias A module pair to be substituted in the script [array]
1401
- --jsx-factory The function that is called for each JSX element [string]
1402
- --jsx-fragment The function that is called for each JSX fragment [string]
1403
- --tsconfig Path to a custom tsconfig.json file [string]
1404
- -r, --remote Run on the global Cloudflare network with access to production resources [boolean] [default: false]
1405
- --minify Minify the script [boolean]
1406
- --node-compat Enable Node.js compatibility [boolean]
1407
- --persist-to Specify directory to use for local persistence (defaults to .wrangler/state) [string]
1408
- --live-reload Auto reload HTML pages when change is detected in local mode [boolean]
1409
- --test-scheduled Test scheduled events by visiting /__scheduled in browser [boolean] [default: false]
1410
- --log-level Specify logging level [choices: \\"debug\\", \\"info\\", \\"log\\", \\"warn\\", \\"error\\", \\"none\\"] [default: \\"log\\"]
1411
- --show-interactive-dev-session Show interactive dev session (defaults to true if the terminal supports interactivity) [boolean]
1412
- --experimental-vectorize-bind-to-prod Bind to production Vectorize indexes in local development mode [boolean] [default: false]
1413
- --experimental-images-local-mode Use a local lower-fidelity implementation of the Images binding [boolean] [default: false]",
1414
- "warn": "",
1415
- }
1416
- ` ) ;
1417
1360
} ) ;
1418
1361
1419
1362
it ( "should error if --legacy-assets and --site are used together" , async ( ) => {
@@ -1831,6 +1774,17 @@ describe.sequential("wrangler dev", () => {
1831
1774
"
1832
1775
` ) ;
1833
1776
} ) ;
1777
+
1778
+ it ( "should also set log level using WRANGLER_LOG'" , async ( ) => {
1779
+ fs . writeFileSync ( "index.js" , `export default {};` ) ;
1780
+ vi . stubEnv ( "WRANGLER_LOG" , "none" ) ;
1781
+ await runWranglerUntilConfig ( "dev index.js --inspect" ) ;
1782
+ expect ( std . warn ) . toMatchInlineSnapshot ( `""` ) ;
1783
+
1784
+ vi . stubEnv ( "WRANGLER_LOG" , "debug" ) ;
1785
+ await runWranglerUntilConfig ( "dev index.js" ) ;
1786
+ expect ( std . debug ) . toContain ( ".env file not found at" ) ;
1787
+ } ) ;
1834
1788
} ) ;
1835
1789
1836
1790
describe ( "--show-interactive-dev-session" , ( ) => {
@@ -1862,7 +1816,7 @@ describe.sequential("wrangler dev", () => {
1862
1816
await runWranglerUntilConfig ( "dev index.js" ) ;
1863
1817
expect ( std . out ) . toMatchInlineSnapshot ( `
1864
1818
"Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
1865
-
1819
+
1866
1820
Your worker has access to the following bindings:
1867
1821
- Services:
1868
1822
- WorkerA: A [not connected]
@@ -1885,7 +1839,7 @@ describe.sequential("wrangler dev", () => {
1885
1839
await runWranglerUntilConfig ( "dev index.js" ) ;
1886
1840
expect ( std . out ) . toMatchInlineSnapshot ( `
1887
1841
"Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
1888
-
1842
+
1889
1843
Your worker has access to the following bindings:
1890
1844
- Services:
1891
1845
- WorkerA: A [not connected]
@@ -1914,7 +1868,7 @@ describe.sequential("wrangler dev", () => {
1914
1868
expect ( std . out ) . toMatchInlineSnapshot ( `
1915
1869
"Using vars defined in .dev.vars
1916
1870
Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
1917
-
1871
+
1918
1872
Your worker has access to the following bindings:
1919
1873
- Vars:
1920
1874
- variable: 123
0 commit comments