File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -886,8 +886,7 @@ test.skip('adjust worker build error for worker.format', async () => {
886
886
expect . unreachable ( )
887
887
} )
888
888
889
- // rolldown does not append plugin name to the message automatically
890
- describe . skip ( 'onRollupLog' , ( ) => {
889
+ describe ( 'onRollupLog' , ( ) => {
891
890
const pluginName = 'rollup-plugin-test'
892
891
const msgInfo = 'This is the INFO message.'
893
892
const msgWarn = 'This is the WARN message.'
@@ -980,7 +979,7 @@ describe.skip('onRollupLog', () => {
980
979
} ,
981
980
} )
982
981
expect ( onLogInfo ) . toBeCalledWith (
983
- expect . objectContaining ( { message : `[ plugin ${ pluginName } ] ${ msgInfo } ` } ) ,
982
+ expect . objectContaining ( { message : msgInfo , plugin : pluginName } ) ,
984
983
)
985
984
} )
986
985
@@ -994,7 +993,7 @@ describe.skip('onRollupLog', () => {
994
993
} ,
995
994
} )
996
995
expect ( onWarn ) . toBeCalledWith (
997
- expect . objectContaining ( { message : `[ plugin ${ pluginName } ] ${ msgWarn } ` } ) ,
996
+ expect . objectContaining ( { message : msgWarn , plugin : pluginName } ) ,
998
997
)
999
998
} )
1000
999
Original file line number Diff line number Diff line change @@ -1134,23 +1134,29 @@ export function onRollupLog(
1134
1134
}
1135
1135
}
1136
1136
1137
+ // append plugin name to align with Rollup's behavior
1138
+ let message = logging . message
1139
+ if ( logging . plugin ) {
1140
+ message = `[plugin ${ logging . plugin } ] ${ message } `
1141
+ }
1142
+
1137
1143
switch ( logLeveling ) {
1138
1144
case 'info' :
1139
- environment . logger . info ( logging . message )
1145
+ environment . logger . info ( message )
1140
1146
return
1141
1147
case 'warn' :
1142
- environment . logger . warn ( colors . yellow ( logging . message ) )
1148
+ environment . logger . warn ( colors . yellow ( message ) )
1143
1149
return
1144
1150
case 'error' :
1145
- environment . logger . error ( colors . red ( logging . message ) )
1151
+ environment . logger . error ( colors . red ( message ) )
1146
1152
return
1147
1153
case 'debug' :
1148
- debugLogger ?.( logging . message )
1154
+ debugLogger ?.( message )
1149
1155
return
1150
1156
default :
1151
1157
logLeveling satisfies never
1152
1158
// fallback to info if a unknown log level is passed
1153
- environment . logger . info ( logging . message )
1159
+ environment . logger . info ( message )
1154
1160
return
1155
1161
}
1156
1162
}
You can’t perform that action at this time.
0 commit comments