title: Jest testing ( using babel ) invalid token import
body: <p>testing a Firebase Function with Jest , I am in trouble with the import .. in my spec file.. </p>
  
  <p>console.log</p>
  
  <pre><code> import 'jest';
      ^^^^^^
  
      SyntaxError: Unexpected token import
  </code></pre>
  
  <p>I am using @babel/core and @babel/preset-env and babel-jest</p>
  
  <p>package.json</p>
  
  <pre><code>"devDependencies": {
  "@babel/core": "^7.1.6",
  "@babel/preset-env": "^7.1.6",
  "@types/jest": "^23.3.10",
  "babel-jest": "^23.6.0",
  "eslint": "^4.12.0",
  "eslint-plugin-promise": "^3.6.0",
  "firebase-functions-test": "^0.1.5",
  "jest": "^23.6.0",
  "ts-jest": "^23.10.5"
  },
  "engines": {
  "node": "8"
  },
  "private": true,
  "jest": {
  "verbose": true,
  "transform": {
    "^.+\\.jsx?$": "babel-jest",
    "^.+\\.tsx?$": "ts-jest"
  },
  "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
  "moduleFileExtensions": [
    "ts",
    "tsx",
    "js",
    "jsx",
    "json",
    "node"
    ]
  }
  </code></pre>
  
  <p>And I created a babel.config.js file</p>
  
  <p>babel.config.js</p>
  
  <pre><code>  module.exports = {
      presets: [
        [
          "@babel/preset-env"
        ]
      ]
    };
  </code></pre>
  
  <p>what do I miss ?
  thanks for feedback</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I updated my config , as stated in Jest Using Babel doc...  ( v 7)</p>
  
  <p>console.log</p>
  
  <pre><code>    Cannot find module 'babel-preset-env' from '/Users/yves/Developments/WIP/VUE.JS-cli-3/4-chocha-home-cloudFunctions/chocha/functions'
          - Did you mean "@babel/env"?
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>    "devDependencies": {
          "@babel/core": "^7.1.6",
          "@babel/preset-env": "^7.1.6",
          "@types/jest": "^23.3.10",
          "babel-core": "^7.0.0-bridge.0",
          "babel-jest": "^23.6.0",
          "eslint": "^4.12.0",
          "eslint-plugin-promise": "^3.6.0",
          "firebase-functions-test": "^0.1.5",
          "jest": "^23.6.0",
          "regenerator-runtime": "^0.13.1",
          "ts-jest": "^23.10.5"
        },
  </code></pre>
  
  <p>babel.config.js</p>
  
  <pre><code>    module.exports = {
      presets: [
      ["@babel/env"]
      ]
      };
  </code></pre>
  
  <p>.babelrc</p>
  
  <pre><code>    {
        "presets": ["env"]
      }
  </code></pre>
  
  <p>But I am still getting an error ... it's not very clear for beginners what should be used actually... too many advices in the doc...
  I am only using JS for Firebase functions, no React, no Vue...</p>
  
  <p>UPDATE</p>
  
  <p>I updated my .babelrc </p>
  
  <pre><code>    {
        "presets": ["@babel/preset-env"]
      }
  </code></pre>
  
  <p>Now I get another Babel error ...</p>
  
  <pre><code>    tests/index.spec.js
        ● Test suite failed to run
  
          TypeError: programPath.hub.addHelper is not a function
  
            at wrapInterop (node_modules/@babel/helper-module-transforms/lib/index.js:165:45)
            at PluginPass.exit (node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js:174:70)
            at newFn (../node_modules/@babel/traverse/lib/visitors.js:237:21)
            at NodePath._call (../node_modules/@babel/traverse/lib/path/context.js:65:20)
            at NodePath.call (../node_modules/@babel/traverse/lib/path/context.js:40:17)
            at NodePath.visit (../node_modules/@babel/traverse/lib/path/context.js:109:8)
            at TraversalContext.visitQueue (../node_modules/@babel/traverse/lib/context.js:142:16)
            at TraversalContext.visitSingle (../node_modules/@babel/traverse/lib/context.js:102:19)
            at TraversalContext.visit (../node_modules/@babel/traverse/lib/context.js:182:19)
            at Function.traverse.node (../node_modules/@babel/traverse/lib/index.js:106:17)
  </code></pre>