@babel/core Jest error: Must export a default export when using ES6 modules

662 Views Asked by At

Running Jest throws this error for a simple test file:

Must export a default export when using ES6 modules.

  at createDescriptor (node_modules/@babel/core/lib/config/config-descriptors.js:170:13)
  at items.map (node_modules/@babel/core/lib/config/config-descriptors.js:110:50)
      at Array.map (<anonymous>)
  at createDescriptors (node_modules/@babel/core/lib/config/config-descriptors.js:110:29)
  at createPresetDescriptors (node_modules/@babel/core/lib/config/config-descriptors.js:102:10)
  at presets (node_modules/@babel/core/lib/config/config-descriptors.js:48:19)
  at mergeChainOpts (node_modules/@babel/core/lib/config/config-chain.js:320:26)
  at node_modules/@babel/core/lib/config/config-chain.js:283:7
  at buildRootChain (node_modules/@babel/core/lib/config/config-chain.js:90:20)
  at loadPrivatePartialConfig (node_modules/@babel/core/lib/config/partial.js:85:55)

The problem is boiled down to @babel/core dependency because when I remove it, it throws Cannot find module 'babel-core' but after I include it, it starts complaining about a required default export.

Is there a way to disable this rule? How can I find the offending file and just maybe add an export default {} there? Anyone else with this problem?

0

There are 0 best solutions below