title: How do I get jest to to work with ES6 dependencies
body: <p>So I have a dependency package that I am pulling into my node_modules folder. This package has a export in it like this </p>
  
  <pre><code>        ({"Object.&lt;anonymous&gt;":function(module,exports,require,__dirname,__filename,global,jest){export * from './client';
  </code></pre>
  
  <p>In order to get around this I use <a href="https://github.com/standard-things/esm" rel="noreferrer">https://github.com/standard-things/esm</a>. In my node loader </p>
  
  <p><code>node -r esm index.js</code>. </p>
  
  <p>However this does not work with my tests which are using Jest. </p>
  
  <p>I cant seem to figure out how to just get Jest to transform these imports for me. I have tried so many things, and the current state of my configuration files is. </p>
  
  <pre><code>// babel.config.js
  // babel.config.js
  module.exports = {
      presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
      plugins: ['@babel/plugin-transform-modules-commonjs'],
  };
  
  </code></pre>
  
  <pre><code>
  const { pathsToModuleNameMapper } = require('ts-jest/utils');
  const { compilerOptions } = require('./tsconfig');
  
  module.exports = {
      preset: 'ts-jest',
      testEnvironment: 'node',
      testMatch: ['&lt;rootDir&gt;/tests/**/*.{ts,js}'],
      testPathIgnorePatterns: ['global.d.ts', 'utils.ts', '&lt;rootDir&gt;/node_modules/'], // tried with and without this
      moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '&lt;rootDir&gt;/' }),
  };
  
  </code></pre>
  
  <p>Still keep getting that error. Anyone have a suggestion. </p>