title: Jest not parsing es6: SyntaxError: Unexpected token import
body: <p>I am trying to setup Jest with my webpack project. When I run my tests, Jest complains it cannot read es6 code. Babel seems to not transform my test files. </p>
  
  <p>I have tried various solutions I have found on the internet but I'm still stumped. Maybe somebody with more Babel/Webpack knowledge can look at my config and help me out. </p>
  
  <p>relevant package.json script:</p>
  
  <pre><code>{
      "test": "jest --no-cache --config config/jest.config.js"
  }
  </code></pre>
  
  <p>relevant package.json deps:</p>
  
  <pre><code>"@babel/core": "^7.2.2",
  "@babel/plugin-proposal-class-properties": "^7.3.0",
  "@babel/preset-env": "^7.3.1",
  "@babel/preset-flow": "^7.0.0",
  "@babel/preset-react": "^7.0.0",
  "babel-eslint": "^10.0.1",
  "babel-jest": "^24.0.0",
  "babel-loader": "^8.0.5",
  "babel-plugin-styled-components": "^1.10.0",
  "jest": "^24.0.0",
  "webpack": "^4.29.0",
  "webpack-cli": "^3.2.1",
  "webpack-dev-server": "^3.1.14"
  </code></pre>
  
  <p>config/webpack.config.js:</p>
  
  <pre><code>entry: './src/index.js',
  mode: isProduction ? 'production' : 'development',
  devtool: isProduction ? 'none' : 'inline-source-map',
  bail: true,
  devServer: {
    contentBase: 'build',
    compress: true,
    port: 3000,
  },
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: '[name].[chunkhash].js',
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            cacheDirectory: true,
            presets: [
              '@babel/preset-env',
              '@babel/preset-react',
              '@babel/preset-flow',
            ],
            plugins: [
              'babel-plugin-styled-components',
              '@babel/plugin-proposal-class-properties',
            ],
          },
        },
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'src/index.html',
    }),
    new webpack.DefinePlugin({
      'process.env': JSON.stringify(process.env),
    }),
  ],
  </code></pre>
  
  <p>config/jest.config.js</p>
  
  <pre><code>module.exports = {
    verbose: true,
    rootDir: '../',
    setupFiles: ['./config/jest.setup.js'],
    transform: {
      '^.+\\.js?$': 'babel-jest',
    },
  </code></pre>
  
  <p>config/jest.setup.js</p>
  
  <pre><code>import Enzyme from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  
  Enzyme.configure({ adapter: new Adapter() });
  </code></pre>
  
  <p>jest error:
  ● Test suite failed to run</p>
  
  <pre><code>Jest encountered an unexpected token
  
  This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
  </code></pre>
  
  <p>...</p>
  
  <pre><code>Details:
  
  /&lt;...projectpath&gt;/config/jest.setup.js:1
  ({"Object.&lt;anonymous&gt;":function(module,exports,require,__dirname,__filename,global,jest){import Enzyme from 'enzyme';
                                                                                           ^^^^^^
  
  SyntaxError: Unexpected token import
  </code></pre>
  
  <p>I want some a working test runner! Im guessing my transform: babel-jest is doing nothing in my jest.config.js... </p>