@@ -535,96 +535,6 @@ describe('ScriptTransformer', () => {
535535 expect ( writeFileAtomic . sync ) . toHaveBeenCalledTimes ( 1 ) ;
536536 } ) ;
537537
538- it ( 'should write a source map for the instrumented file when transformed' , ( ) => {
539- const transformerConfig = {
540- ...config ,
541- transform : [ [ '^.+\\.js$' , 'preprocessor-with-sourcemaps' ] ] ,
542- } ;
543- const scriptTransformer = new ScriptTransformer ( transformerConfig ) ;
544-
545- const map = {
546- mappings : ';AAAA' ,
547- version : 3 ,
548- } ;
549-
550- // A map from the original source to the instrumented output
551- /* eslint-disable sort-keys */
552- const instrumentedCodeMap = {
553- version : 3 ,
554- sources : [ 'banana.js' ] ,
555- names : [ 'content' ] ,
556- mappings : ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAO' ,
557- sourcesContent : [ 'content' ] ,
558- } ;
559- /* eslint-enable */
560-
561- require ( 'preprocessor-with-sourcemaps' ) . process . mockReturnValue ( {
562- code : 'content' ,
563- map,
564- } ) ;
565-
566- const result = scriptTransformer . transform (
567- '/fruits/banana.js' ,
568- makeGlobalConfig ( {
569- collectCoverage : true ,
570- } ) ,
571- ) ;
572- expect ( result . sourceMapPath ) . toEqual ( expect . any ( String ) ) ;
573- expect ( writeFileAtomic . sync ) . toBeCalledTimes ( 2 ) ;
574- expect ( writeFileAtomic . sync ) . toBeCalledWith (
575- result . sourceMapPath ,
576- JSON . stringify ( instrumentedCodeMap ) ,
577- {
578- encoding : 'utf8' ,
579- fsync : false ,
580- } ,
581- ) ;
582-
583- // Inline source map allows debugging of original source when running instrumented code
584- expect ( result . code ) . toContain ( '//# sourceMappingURL' ) ;
585- } ) ;
586-
587- it ( 'should write a source map for the instrumented file when not transformed' , ( ) => {
588- const scriptTransformer = new ScriptTransformer ( config ) ;
589-
590- // A map from the original source to the instrumented output
591- /* eslint-disable sort-keys */
592- const instrumentedCodeMap = {
593- version : 3 ,
594- sources : [ 'banana.js' ] ,
595- names : [ 'module' , 'exports' ] ,
596- mappings :
597- ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,MAAM,CAACC,OAAP,GAAiB,QAAjB' ,
598- sourcesContent : [ 'module.exports = "banana";' ] ,
599- } ;
600- /* eslint-enable */
601-
602- require ( 'preprocessor-with-sourcemaps' ) . process . mockReturnValue ( {
603- code : 'content' ,
604- map : null ,
605- } ) ;
606-
607- const result = scriptTransformer . transform (
608- '/fruits/banana.js' ,
609- makeGlobalConfig ( {
610- collectCoverage : true ,
611- } ) ,
612- ) ;
613- expect ( result . sourceMapPath ) . toEqual ( expect . any ( String ) ) ;
614- expect ( writeFileAtomic . sync ) . toBeCalledTimes ( 2 ) ;
615- expect ( writeFileAtomic . sync ) . toBeCalledWith (
616- result . sourceMapPath ,
617- JSON . stringify ( instrumentedCodeMap ) ,
618- {
619- encoding : 'utf8' ,
620- fsync : false ,
621- } ,
622- ) ;
623-
624- // Inline source map allows debugging of original source when running instrumented code
625- expect ( result . code ) . toContain ( '//# sourceMappingURL' ) ;
626- } ) ;
627-
628538 it ( 'passes expected transform options to getCacheKey' , ( ) => {
629539 config = { ...config , transform : [ [ '^.+\\.js$' , 'test_preprocessor' ] ] } ;
630540 const scriptTransformer = new ScriptTransformer ( config ) ;
0 commit comments