title: Import Unexpected identifier + SyntaxError: Unexpected string
body: <p>I'm having a problem when running jest test. I'm getting an import unexpected identifier</p>
  
  <p>I have already tried by cleaning npm cache and <a href="https://stackoverflow.com/questions/33604470/unexpected-token-import-in-nodejs5-and-babel">installing</a> npm babel jest, polyfill, preset-es2015. I've also <a href="https://github.com/facebook/jest/issues/4604" rel="noreferrer">read this</a> trying some different configs here and there. </p>
  
  <p>This is my <code>babel.config.js</code></p>
  
  <pre><code>module.exports = {
    presets: [
      '@vue/app'
    ],
    env: {
      test: {
        plugins: [
          "transform-strict-mode",
          "transform-es2015-modules-commonjs",
          "transform-es2015-spread",
          "transform-es2015-destructuring",
          "transform-es2015-parameters"
        ]
      }
    }
  }
  
  </code></pre>
  
  <p>and my <code>jest config</code> in package.json </p>
  
  <pre><code>"jest": {
      "moduleFileExtensions": [
        "js",
        "json",
        "vue"
      ],
      "transform": {
        "^.+\\.js$": "babel-jest",
        ".*\\.(vue)$": "vue-jest"
      },
      "moduleNameMapper": {
        "^@/(.*)$": "&lt;rootDir&gt;/src/$1"
      }
    }
  </code></pre>
  
  <p>Here is the error.</p>
  
  <pre><code>Test suite failed to run
  
      PCROUTE\Test.test.js:3
      import _interopRequireDefault from "PCROUTE\\node_modules\\@babel\\runtime-corejs2/helpers/esm/interopRequireDefault";
             ^^^^^^^^^^^^^^^^^^^^^^
  
      SyntaxError: Unexpected identifier
  </code></pre>
  
  <p>I'm expecting to pass the test but I'm getting that error message. I think the problem comes with the env part in the babel.config.js</p>
  
  <p><strong>Edit: I'm also using windows 7</strong>, and I this can be causing those back and forward mixed slashes. </p>
  
  <p><strong>Edit2: I just tested it in Linux and it doesn't work.</strong> I have all in forward slashes</p>
  
  <pre><code> PCROUTE/src/tests/Test.test.js:3
      import _interopRequireDefault from "PCROUTE/node_modules/@babel/runtime-corejs2/helpers/esm/interopRequireDefault";
             ^^^^^^^^^^^^^^^^^^^^^^
  
      SyntaxError: Unexpected identifier
  
        at ScriptTransformer._transformAndBuildScript 
  </code></pre>
  
  <p><strong>Edit 3: I saw a lot of people fixed it with [these lines]</strong>(<a href="https://github.com/vuejs/vue-cli/issues/1879#issuecomment-409872897" rel="noreferrer">https://github.com/vuejs/vue-cli/issues/1879#issuecomment-409872897</a>).</p>
  
  <pre><code>transformIgnorePatterns: [
      "node_modules/(?!(babel-jest|jest-vue-preprocessor)/)"
    ]
  </code></pre>
  
  <p>in the <code>jest config file</code>. I added them and ran this <code>./node_modules/jest/bin/jest.js --clearCache</code> but it doesn't work. </p>
  
  <p><strong>Edit 4:</strong> I just added a couple of things to my jest file. And deleted a couple in my babel file, and <strong>now I'm getting. <code>Unexpected String</code></strong> </p>
  
  <p>NEW JEST FILE</p>
  
  <pre><code>module.exports = {
      moduleFileExtensions: [
        'js',
        'jsx',
        'json',
        'vue'
      ],
      transform: {
        '^.+\\.vue$': 'vue-jest',
        '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
        '^.+\\.jsx?$': 'babel-jest'
      },
      transformIgnorePatterns: [
        '/node_modules/'
      ],
      moduleNameMapper: {
        '^@/(.*)$': '&lt;rootDir&gt;/src/$1'
      },
      snapshotSerializers: [
        'jest-serializer-vue'
      ],
      testMatch: [
        '**/tests/**/*.test.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
      ],
      testURL: 'http://localhost/',
      watchPlugins: [
        'jest-watch-typeahead/filename',
        'jest-watch-typeahead/testname'
      ]
    }
  </code></pre>
  
  <p>And I <strong>deleted everything from my babel file</strong> except the <code>presets: @vue/app</code> part.</p>
  
  <p>Here is the new error I'm getting.</p>
  
  <pre><code>({"Object.&lt;anonymous&gt;":function(module,exports,require,__dirname,__filename,global,jest){import "core-js/modules/es6.array.find";
                                                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
      SyntaxError: Unexpected string
  </code></pre>