@@ -579,6 +579,60 @@ describe('resolveBuildOutputs', () => {
579579 )
580580 } )
581581 } )
582+
583+ describe ( 'output minify and comments resolution in resolveRolldownOptions' , ( ) => {
584+ const buildProjectRoot = resolve ( dirname , 'packages/build-project' )
585+
586+ test ( 'merges a partial output.minify object with the lib defaults' , async ( ) => {
587+ const builder = await createBuilder ( {
588+ root : buildProjectRoot ,
589+ logLevel : 'silent' ,
590+ build : {
591+ minify : 'oxc' ,
592+ lib : { ...baseLibOptions , formats : [ 'es' ] } ,
593+ rolldownOptions : {
594+ output : {
595+ minify : { mangle : { keepNames : true } } ,
596+ } ,
597+ } ,
598+ } ,
599+ } )
600+ const options = resolveRolldownOptions (
601+ builder . environments . client ,
602+ new ChunkMetadataMap ( ) ,
603+ )
604+ const outputs = options . output !
605+ const output = Array . isArray ( outputs ) ? outputs [ 0 ] : outputs
606+ expect ( output . minify ) . toStrictEqual ( {
607+ compress : true ,
608+ mangle : { keepNames : true } ,
609+ codegen : false ,
610+ } )
611+ } )
612+
613+ test ( 'keeps an explicit boolean output.minify untouched' , async ( ) => {
614+ const builder = await createBuilder ( {
615+ root : buildProjectRoot ,
616+ logLevel : 'silent' ,
617+ build : {
618+ minify : 'oxc' ,
619+ lib : { ...baseLibOptions , formats : [ 'es' ] } ,
620+ rolldownOptions : {
621+ output : {
622+ minify : false ,
623+ } ,
624+ } ,
625+ } ,
626+ } )
627+ const options = resolveRolldownOptions (
628+ builder . environments . client ,
629+ new ChunkMetadataMap ( ) ,
630+ )
631+ const outputs = options . output !
632+ const output = Array . isArray ( outputs ) ? outputs [ 0 ] : outputs
633+ expect ( output . minify ) . toBe ( false )
634+ } )
635+ } )
582636} )
583637
584638describe ( 'resolveLibFilename' , ( ) => {
0 commit comments