Testing 笑话:Can';不使用默认导出?

Testing 笑话:Can';不使用默认导出?,testing,jestjs,es6-modules,babel-jest,Testing,Jestjs,Es6 Modules,Babel Jest,我遇到了一个奇怪的问题,在模块上使用export default时,Jest似乎不起作用 我创建了一份回购样本,以重现该问题: 鉴于本模块,其要点是: const a = { greet () { return 'Hello World' } } const b = { foo () { return 'bar' } } export default { a, b } 这项工作: import myModule from '../src'

我遇到了一个奇怪的问题,在模块上使用
export default
时,Jest似乎不起作用

我创建了一份回购样本,以重现该问题:

鉴于本模块,其要点是:

const a = {
  greet () {
    return 'Hello World'
  }
}

const b = {
  foo () {
    return 'bar'
  }
}

export default {
  a,
  b
}    
这项工作:

import myModule from '../src'

describe('My module', () => {
  it('works if I import the whole module', () => {
    const greeting = myModule.a.greet()
    const foo = myModule.b.foo()
    expect(greeting).toBe('Hello World')
    expect(foo).toBe('bar')
  })
})
但这会导致
a
b
未定义

import { a, b } from '../src'

describe('My module', () => {
  it('works if I import individual exports', () => {
    const greeting = a.greet()
    const foo = b.foo()
    expect(greeting).toBe('Hello World')
    expect(foo).toBe('bar')
  })
})
请参阅提供的repo以了解
。babelrc
设置等

使用节点
7.3.0