@@ -70,6 +70,8 @@ describe("'wrangler dev' correctly displays logs", () => {
70
70
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1m<<<<<this is an error>>>>>[0m
71
71
[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m<<<<<this is a warning>>>>>[0m
72
72
<<<<<this is a log>>>>>
73
+ <<<<<this is a stderr message>>>>>
74
+ <<<<<this is a stdout message>>>>>
73
75
<<<<<this is an info message>>>>>"
74
76
` ) ;
75
77
} ) ;
@@ -80,6 +82,8 @@ describe("'wrangler dev' correctly displays logs", () => {
80
82
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1m<<<<<this is an error>>>>>[0m
81
83
[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m<<<<<this is a warning>>>>>[0m
82
84
<<<<<this is a log>>>>>
85
+ <<<<<this is a stderr message>>>>>
86
+ <<<<<this is a stdout message>>>>>
83
87
<<<<<this is an info message>>>>>"
84
88
` ) ;
85
89
} ) ;
@@ -111,15 +115,24 @@ describe("'wrangler dev' correctly displays logs", () => {
111
115
} ) ;
112
116
113
117
test ( "with --log-level=debug" , async ( { expect } ) => {
114
- const output = await getWranglerDevOutput (
115
- "module" ,
116
- [ "--log-level=debug" ] ,
117
- undefined ,
118
- // For some reason in debug mode two requests are
119
- // needed to trigger the log here...
120
- 2
118
+ const output = await getWranglerDevOutput ( "module" , [
119
+ "--log-level=debug" ,
120
+ ] ) ;
121
+ expect (
122
+ Array . from ( output . matchAll ( / ^ .* < < < < < .* $ / gm) ) . flat ( )
123
+ ) . toMatchInlineSnapshot (
124
+ `
125
+ [
126
+ "[31mX [41;31m[[41;97mERROR[41;31m][0m [1m<<<<<this is an error>>>>>[0m",
127
+ "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m<<<<<this is a warning>>>>>[0m",
128
+ "<<<<<this is a debug message>>>>>",
129
+ "<<<<<this is a log>>>>>",
130
+ "<<<<<this is a stderr message>>>>>",
131
+ "<<<<<this is a stdout message>>>>>",
132
+ "<<<<<this is an info message>>>>>",
133
+ ]
134
+ `
121
135
) ;
122
- expect ( output ) . toContain ( "<<<<<this is a debug message>>>>>" ) ;
123
136
} ) ;
124
137
125
138
test ( 'with WRANGLER_LOG="debug"' , async ( { expect } ) => {
0 commit comments