File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,25 @@ function importBabelDeps() {
2626 if ( babel ) return ; // tslint:disable-line
2727 // we must use babel until we handle hoisting of jest.mock() internally
2828 babel = importBabelCore ( ) ;
29+
30+ // HACK: there is an issue still open in babel 6, this is a hack to bypass it
31+ // and fix our issue #627
32+ // Issue in babel: https://github.com/babel/babel/issues/6577
33+ if ( babel . version && parseInt ( babel . version . split ( '.' ) [ 0 ] , 10 ) === 6 ) {
34+ const File = require ( 'babel-core/lib/transformation/file/index.js' ) . File ;
35+ File . prototype . initOptions = ( original => {
36+ return function ( opt ) {
37+ const before = opt . sourceMaps ;
38+ const result = original . apply ( this , arguments ) ;
39+ if ( opt . sourceMaps != null && opt . sourceMaps !== result . sourceMaps ) {
40+ result . sourceMaps = opt . sourceMaps ;
41+ }
42+ return result ;
43+ } ;
44+ } ) ( File . prototype . initOptions ) ;
45+ }
46+ // end of HACK
47+
2948 istanbulPlugin = importBabelPluginIstanbul ( ) ;
3049 jestPreset = importBabelPresetJest ( ) ;
3150}
You can’t perform that action at this time.
0 commit comments