@@ -11,6 +11,7 @@ import { fileURLToPath } from 'node:url';
1111import { pluginModuleFederation } from '@module-federation/rsbuild-plugin' ;
1212import {
1313 type InspectConfigResult ,
14+ type LogLevel ,
1415 mergeRsbuildConfig as mergeConfig ,
1516} from '@rsbuild/core' ;
1617import type { Format , LibConfig , RslibConfig } from '@rslib/core' ;
@@ -223,14 +224,16 @@ export async function getResults(
223224 } ;
224225}
225226
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+ } ;
234237
235238export async function rslibBuild ( {
236239 cwd,
@@ -258,6 +261,7 @@ export async function buildAndGetResults(options: {
258261 configPath ?: string ;
259262 type : 'all' ;
260263 lib ?: string [ ] ;
264+ logLevel ?: LogLevel ;
261265} ) : Promise < {
262266 js : BuildResult ;
263267 dts : BuildResult ;
@@ -268,22 +272,25 @@ export async function buildAndGetResults(options: {
268272 configPath ?: string ;
269273 type ?: 'js' | 'dts' | 'css' ;
270274 lib ?: string [ ] ;
275+ logLevel ?: LogLevel ;
271276} ) : Promise < BuildResult > ;
272277export async function buildAndGetResults ( {
273278 fixturePath,
274279 configPath,
275280 type = 'js' ,
276281 lib,
282+ logLevel = 'warn' ,
277283} : {
278284 fixturePath : string ;
279285 configPath ?: string ;
280286 type ?: 'js' | 'dts' | 'css' | 'all' ;
281287 lib ?: string [ ] ;
288+ logLevel ?: LogLevel ;
282289} ) {
283290 const { rsbuildInstance, rslibConfig } = await rslibBuild ( {
284291 cwd : fixturePath ,
285292 path : configPath ,
286- modifyConfig : updateConfigForTest ,
293+ modifyConfig : updateConfigForTest ( logLevel ) ,
287294 lib,
288295 } ) ;
289296 const {
0 commit comments