@@ -896,12 +896,14 @@ describe('`transform()`', () => {
896896 expect ( callbackData ) . not . toBeDefined ( ) ;
897897 } ) ;
898898
899- test ( 'calls the `onTransformEndFn` callback of each plugin, if defined, when `transform` has finished running' , async ( ) => {
899+ test ( 'calls the `onTransformStart` and `onTransformEnd` callbacks of each plugin, if defined, when `transform` has finished running' , async ( ) => {
900+ const onTransformStartFn = jest . fn ( ) ;
900901 const onTransformEndFn = jest . fn ( ) ;
901902 const plugins = [
902903 {
903904 module : {
904905 name : 'sourcebit-test1' ,
906+ onTransformStart : onTransformStartFn ,
905907 onTransformEnd : onTransformEndFn ,
906908 transform : async ( { data } ) => {
907909 return {
@@ -938,6 +940,13 @@ describe('`transform()`', () => {
938940 } ;
939941 }
940942 }
943+ } ,
944+ {
945+ module : {
946+ name : 'sourcebit-test4' ,
947+ onTransformStart : onTransformStartFn ,
948+ onTransformEnd : onTransformEndFn
949+ }
941950 }
942951 ] ;
943952 const callback = jest . fn ( ) ;
@@ -950,7 +959,15 @@ describe('`transform()`', () => {
950959
951960 const data = await sourcebit . transform ( ) ;
952961
953- expect ( onTransformEndFn ) . toHaveBeenCalledTimes ( 3 ) ;
962+ expect ( onTransformStartFn ) . toHaveBeenCalledTimes ( 2 ) ;
963+ expect ( onTransformEndFn ) . toHaveBeenCalledTimes ( 4 ) ;
964+
965+ onTransformStartFn . mock . calls . forEach ( call => {
966+ expect ( call [ 0 ] . debug ) . toBeInstanceOf ( Function ) ;
967+ expect ( call [ 0 ] . getPluginContext ) . toBeInstanceOf ( Function ) ;
968+ expect ( call [ 0 ] . log ) . toBeInstanceOf ( Function ) ;
969+ expect ( call [ 0 ] . options ) . toEqual ( { } ) ;
970+ } ) ;
954971
955972 onTransformEndFn . mock . calls . forEach ( call => {
956973 expect ( call [ 0 ] . debug ) . toBeInstanceOf ( Function ) ;
0 commit comments