@@ -11,6 +11,7 @@ import { fileURLToPath } from 'node:url';
11
11
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin' ;
12
12
import {
13
13
type InspectConfigResult ,
14
+ type LogLevel ,
14
15
mergeRsbuildConfig as mergeConfig ,
15
16
} from '@rsbuild/core' ;
16
17
import type { Format , LibConfig , RslibConfig } from '@rslib/core' ;
@@ -223,14 +224,16 @@ export async function getResults(
223
224
} ;
224
225
}
225
226
226
- const updateConfigForTest = ( rslibConfig : RslibConfig ) => {
227
- Object . assign ( rslibConfig , {
228
- performance : {
229
- // Do not print file size in tests
230
- printFileSize : false ,
231
- } ,
232
- } ) ;
233
- } ;
227
+ const updateConfigForTest =
228
+ ( logLevel ?: LogLevel ) => ( rslibConfig : RslibConfig ) => {
229
+ Object . assign ( rslibConfig , {
230
+ performance : {
231
+ // Do not print file size in tests
232
+ printFileSize : false ,
233
+ } ,
234
+ logLevel,
235
+ } ) ;
236
+ } ;
234
237
235
238
export async function rslibBuild ( {
236
239
cwd,
@@ -258,6 +261,7 @@ export async function buildAndGetResults(options: {
258
261
configPath ?: string ;
259
262
type : 'all' ;
260
263
lib ?: string [ ] ;
264
+ logLevel ?: LogLevel ;
261
265
} ) : Promise < {
262
266
js : BuildResult ;
263
267
dts : BuildResult ;
@@ -268,22 +272,25 @@ export async function buildAndGetResults(options: {
268
272
configPath ?: string ;
269
273
type ?: 'js' | 'dts' | 'css' ;
270
274
lib ?: string [ ] ;
275
+ logLevel ?: LogLevel ;
271
276
} ) : Promise < BuildResult > ;
272
277
export async function buildAndGetResults ( {
273
278
fixturePath,
274
279
configPath,
275
280
type = 'js' ,
276
281
lib,
282
+ logLevel = 'warn' ,
277
283
} : {
278
284
fixturePath : string ;
279
285
configPath ?: string ;
280
286
type ?: 'js' | 'dts' | 'css' | 'all' ;
281
287
lib ?: string [ ] ;
288
+ logLevel ?: LogLevel ;
282
289
} ) {
283
290
const { rsbuildInstance, rslibConfig } = await rslibBuild ( {
284
291
cwd : fixturePath ,
285
292
path : configPath ,
286
- modifyConfig : updateConfigForTest ,
293
+ modifyConfig : updateConfigForTest ( logLevel ) ,
287
294
lib,
288
295
} ) ;
289
296
const {
0 commit comments