11import { afterEach , describe , expect , test , vi } from 'vitest'
2- import fs from 'node:fs'
32import { BuildCancelledError } from '../../src/errors/CustomError'
43
54const mockRspack = vi . fn ( )
@@ -16,8 +15,6 @@ vi.mock('../../src/config/makeRspackConfig.js', () => ({
1615vi . mock ( '../../src/utils/telemetry.utils.js' , ( ) => ( {
1716 default : {
1817 compilePackage : mockCompilePackage ,
19- parseWebpackStats : vi . fn ( ) ,
20- assetsGZIPParseTime : vi . fn ( ) ,
2118 } ,
2219} ) )
2320
@@ -216,32 +213,4 @@ describe('BuildUtils.buildPackage', () => {
216213 missingModules : [ 'missing-package' ] ,
217214 } )
218215 } )
219-
220- test ( 'preserves emitted assets that do not use the bundle filename pattern' , async ( ) => {
221- const stats = {
222- compilation : { errors : [ ] } ,
223- toJson : ( ) => ( {
224- assets : [
225- { name : 'main.bundle.js' , size : 100 , chunkNames : [ 'main' ] } ,
226- { name : 'assets/module.wasm' , size : 50 , chunkNames : [ ] } ,
227- ] ,
228- } ) ,
229- }
230-
231- vi . spyOn ( BuildUtils , 'createEntryPoint' ) . mockReturnValue ( '/tmp/index.js' )
232- vi . spyOn ( BuildUtils , 'compilePackage' ) . mockResolvedValue ( {
233- error : null ,
234- stats : stats as any ,
235- } )
236- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValue (
237- Buffer . from ( 'asset contents' ) ,
238- )
239-
240- await expect ( BuildUtils . buildPackage ( buildArgs ) ) . resolves . toMatchObject ( {
241- assets : [
242- { name : 'main' , type : 'js' , size : 100 } ,
243- { name : 'module' , type : 'wasm' , size : 50 } ,
244- ] ,
245- } )
246- } )
247216} )
0 commit comments