@@ -100,7 +100,8 @@ describe('wrappingLoader', () => {
100100
101101 await loaderPromise ;
102102
103- expect ( callback ) . toHaveBeenCalledWith ( null , expect . stringContaining ( "'/my/route'" ) , expect . anything ( ) ) ;
103+ // Rolldown uses double quotes, old Rollup used single quotes
104+ expect ( callback ) . toHaveBeenCalledWith ( null , expect . stringMatching ( / [ " ' ] \/ m y \/ r o u t e [ ' " ] / ) , expect . anything ( ) ) ;
104105 } ) ;
105106
106107 describe ( 'middleware wrapping' , ( ) => {
@@ -148,8 +149,8 @@ describe('wrappingLoader', () => {
148149 expect ( wrappedCode ) . toContain ( 'userProvidedProxy = true' ) ;
149150
150151 // Proxy should be wrapped, middleware should be undefined
151- expect ( wrappedCode ) . toMatch ( / c o n s t p r o x y = u s e r P r o v i d e d P r o x y \? w r a p p e d H a n d l e r : u n d e f i n e d / ) ;
152- expect ( wrappedCode ) . toMatch ( / c o n s t m i d d l e w a r e = u s e r P r o v i d e d M i d d l e w a r e \? w r a p p e d H a n d l e r : u n d e f i n e d / ) ;
152+ expect ( wrappedCode ) . toMatch ( / c o n s t p r o x y = u s e r P r o v i d e d P r o x y \? w r a p p e d H a n d l e r : (?: u n d e f i n e d | v o i d 0 ) / ) ;
153+ expect ( wrappedCode ) . toMatch ( / c o n s t m i d d l e w a r e = u s e r P r o v i d e d M i d d l e w a r e \? w r a p p e d H a n d l e r : (?: u n d e f i n e d | v o i d 0 ) / ) ;
153154 } ) ;
154155
155156 it ( 'should export middleware when user exports named "middleware" export' , async ( ) => {
@@ -196,8 +197,8 @@ describe('wrappingLoader', () => {
196197 expect ( wrappedCode ) . toContain ( 'userProvidedProxy = false' ) ;
197198
198199 // Middleware should be wrapped, proxy should be undefined
199- expect ( wrappedCode ) . toMatch ( / c o n s t m i d d l e w a r e = u s e r P r o v i d e d M i d d l e w a r e \? w r a p p e d H a n d l e r : u n d e f i n e d / ) ;
200- expect ( wrappedCode ) . toMatch ( / c o n s t p r o x y = u s e r P r o v i d e d P r o x y \? w r a p p e d H a n d l e r : u n d e f i n e d / ) ;
200+ expect ( wrappedCode ) . toMatch ( / c o n s t m i d d l e w a r e = u s e r P r o v i d e d M i d d l e w a r e \? w r a p p e d H a n d l e r : (?: u n d e f i n e d | v o i d 0 ) / ) ;
201+ expect ( wrappedCode ) . toMatch ( / c o n s t p r o x y = u s e r P r o v i d e d P r o x y \? w r a p p e d H a n d l e r : (?: u n d e f i n e d | v o i d 0 ) / ) ;
201202 } ) ;
202203
203204 it ( 'should export undefined middleware/proxy when user only exports default' , async ( ) => {
@@ -245,8 +246,8 @@ describe('wrappingLoader', () => {
245246 expect ( wrappedCode ) . toContain ( 'userProvidedProxy = false' ) ;
246247
247248 // Both middleware and proxy should be undefined (conditionals evaluate to false)
248- expect ( wrappedCode ) . toMatch ( / c o n s t m i d d l e w a r e = u s e r P r o v i d e d M i d d l e w a r e \? w r a p p e d H a n d l e r : u n d e f i n e d / ) ;
249- expect ( wrappedCode ) . toMatch ( / c o n s t p r o x y = u s e r P r o v i d e d P r o x y \? w r a p p e d H a n d l e r : u n d e f i n e d / ) ;
249+ expect ( wrappedCode ) . toMatch ( / c o n s t m i d d l e w a r e = u s e r P r o v i d e d M i d d l e w a r e \? w r a p p e d H a n d l e r : (?: u n d e f i n e d | v o i d 0 ) / ) ;
250+ expect ( wrappedCode ) . toMatch ( / c o n s t p r o x y = u s e r P r o v i d e d P r o x y \? w r a p p e d H a n d l e r : (?: u n d e f i n e d | v o i d 0 ) / ) ;
250251 } ) ;
251252 } ) ;
252253} ) ;
0 commit comments