@@ -36,11 +36,12 @@ function foo(){console.log("Hello World!")}foo();`;
3636 } ;
3737
3838 const processedSource = (
39+ debugIdGenerator : DebugIdGenerator ,
3940 debugId : string ,
40- ) => `;!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._btDebugIds=e._btDebugIds||{},e._btDebugIds[n]=" ${ debugId } ")}catch(e){}}();
41+ ) => `${ debugIdGenerator . generateSourceSnippet ( debugId ) }
4142(()=>{"use strict";console.log("Hello World!")})();
4243//# sourceMappingURL=source.js.map
43- //# debugId= ${ debugId }
44+ ${ debugIdGenerator . generateSourceComment ( debugId ) }
4445` ;
4546
4647 const processedSourceMap = ( debugId : string ) => ( {
@@ -225,7 +226,7 @@ function foo(){console.log("Hello World!")}foo();`;
225226
226227 await sourceProcessor . processSourceAndSourceMapFiles ( sourcePath , sourceMapPath , debugId ) ;
227228
228- expect ( processFn ) . toBeCalledWith ( sourceContent , sourceMapContent , debugId ) ;
229+ expect ( processFn ) . toBeCalledWith ( sourceContent , sourceMapContent , debugId , undefined ) ;
229230 } ) ;
230231
231232 it ( 'should call process function with sourcemap detected from source' , async ( ) => {
@@ -246,22 +247,24 @@ function foo(){console.log("Hello World!")}foo();`;
246247
247248 await sourceProcessor . processSourceAndSourceMapFiles ( sourcePath , undefined , debugId ) ;
248249
249- expect ( processFn ) . toBeCalledWith ( sourceContent , sourceMapContent , debugId ) ;
250+ expect ( processFn ) . toBeCalledWith ( sourceContent , sourceMapContent , debugId , undefined ) ;
250251 } ) ;
251252
252253 it ( 'should return unmodified source when source has debug ID' , async ( ) => {
253254 const debugId = randomUUID ( ) ;
254- const source = processedSource ( debugId ) ;
255- const sourceProcessor = new SourceProcessor ( new DebugIdGenerator ( ) ) ;
255+ const debugIdGenerator = new DebugIdGenerator ( ) ;
256+ const source = processedSource ( debugIdGenerator , debugId ) ;
257+ const sourceProcessor = new SourceProcessor ( debugIdGenerator ) ;
256258 const result = await sourceProcessor . processSourceAndSourceMap ( source , processedSourceMap ( debugId ) ) ;
257259
258260 expect ( result . source ) . toEqual ( source ) ;
259261 } ) ;
260262
261263 it ( 'should return unmodified source when source has same debug ID as provided' , async ( ) => {
262264 const debugId = randomUUID ( ) ;
263- const source = processedSource ( debugId ) ;
264- const sourceProcessor = new SourceProcessor ( new DebugIdGenerator ( ) ) ;
265+ const debugIdGenerator = new DebugIdGenerator ( ) ;
266+ const source = processedSource ( debugIdGenerator , debugId ) ;
267+ const sourceProcessor = new SourceProcessor ( debugIdGenerator ) ;
265268 const result = await sourceProcessor . processSourceAndSourceMap (
266269 source ,
267270 processedSourceMap ( debugId ) ,
@@ -273,17 +276,21 @@ function foo(){console.log("Hello World!")}foo();`;
273276
274277 it ( "should return sourcemap with source's debug ID when source has debug ID" , async ( ) => {
275278 const debugId = randomUUID ( ) ;
276- const sourceProcessor = new SourceProcessor ( new DebugIdGenerator ( ) ) ;
277- const result = await sourceProcessor . processSourceAndSourceMap ( processedSource ( debugId ) , sourceMap ) ;
279+ const debugIdGenerator = new DebugIdGenerator ( ) ;
280+ const sourceProcessor = new SourceProcessor ( debugIdGenerator ) ;
281+ const result = await sourceProcessor . processSourceAndSourceMap (
282+ processedSource ( debugIdGenerator , debugId ) ,
283+ sourceMap ,
284+ ) ;
278285
279286 expect ( result . sourceMap . debugId ) . toEqual ( debugId ) ;
280287 } ) ;
281288
282289 it ( 'should call replace debug ID when source has different debug ID than provided' , async ( ) => {
283290 const oldDebugId = randomUUID ( ) ;
284291 const newDebugId = randomUUID ( ) ;
285- const source = processedSource ( oldDebugId ) ;
286292 const debugIdGenerator = new DebugIdGenerator ( ) ;
293+ const source = processedSource ( debugIdGenerator , oldDebugId ) ;
287294
288295 const spy = jest . spyOn ( debugIdGenerator , 'replaceDebugId' ) ;
289296
0 commit comments