File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { File } from 'babel-core/lib/transformation/file'
2-
31import * as hacks from './hacks'
42
53jest . mock (
@@ -20,10 +18,15 @@ jest.mock(
2018 { virtual : true } ,
2119)
2220
21+ beforeEach ( ( ) => {
22+ jest . resetModules ( )
23+ } )
24+
2325describe ( 'patchBabelCore_githubIssue6577' , ( ) => {
2426 const INPUT = 'foo:bar'
2527 const initOptions = ( { version = '6.0.0' , sourceMaps } : { version ?: any ; sourceMaps ?: any } = { } ) => {
2628 hacks . patchBabelCore_githubIssue6577 ( { version } as any )
29+ const { File } = require ( 'babel-core/lib/transformation/file' )
2730 return new File ( ) . initOptions ( { sourceMaps, inputSourceMap : true } )
2831 }
2932
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ export const patchBabelCore_githubIssue6577: ModulePatcher<TBabelCore> = babel =
1212 // This is a hack to bypass it and fix our issue #627
1313 // The bug disallow debugging when using Babel Jest with babel-core@6.x because of
1414 // source-maps not being inlined
15- if ( typeof babel . version === 'string' && semver . satisfies ( babel . version , '>=6 <7' ) ) {
15+ if ( typeof babel . version !== 'string' ) return babel
16+ const version = semver . coerce ( babel . version )
17+ if ( version && version . major === 6 ) {
1618 try {
1719 const File = require ( 'babel-core/lib/transformation/file' ) . File
1820 File . prototype . initOptions = ( original => {
You can’t perform that action at this time.
0 commit comments