File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
packages/next-plugin/src/__tests__ Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -307,4 +307,31 @@ describe('preload', () => {
307307 true ,
308308 )
309309 } )
310+
311+ it ( 'should return early when nested is true and include packages exist' , ( ) => {
312+ vi . mocked ( findTopPackageRoot ) . mockReturnValue ( '/repo' )
313+ vi . mocked ( hasLocalPackage ) . mockReturnValue ( true )
314+ // Return empty array so no recursive calls happen, but include.length > 0 check passes
315+ vi . mocked ( globSync ) . mockReturnValue ( [ ] )
316+ vi . mocked ( getPackageName ) . mockReturnValue ( 'pkg-a' )
317+
318+ // Call with nested = true (7th parameter)
319+ preload (
320+ / n o d e _ m o d u l e s / ,
321+ '@devup-ui/react' ,
322+ false ,
323+ '/output/css' ,
324+ [ 'pkg-a' ] ,
325+ '/some/path' ,
326+ true ,
327+ )
328+
329+ // When nested is true, it should return early after processing includes
330+ // and not write the final devup-ui.css file
331+ expect ( writeFileSync ) . not . toHaveBeenCalledWith (
332+ expect . stringContaining ( 'devup-ui.css' ) ,
333+ expect . any ( String ) ,
334+ 'utf-8' ,
335+ )
336+ } )
310337} )
You can’t perform that action at this time.
0 commit comments