title: JEST test suite fails with TypeError: environment.setup is not a function
body: <p>I'm trying to add tests to my app and the test fails with the following error:</p>
  
  <blockquote>
    <p>Test suite failed to run</p>
  
  <pre><code>TypeError: environment.setup is not a function
  
    at node_modules/jest-runner/build/run_test.js:71:23
  </code></pre>
  </blockquote>
  
  <p>Below are my config files used in a  project:</p>
  
  <blockquote>
    <p>.babelrc</p>
  
  <pre><code>{
      "presets": [
          "env",
          "react"
      ],
      "plugins": [
          "transform-class-properties",
          "transform-object-rest-spread"
      ],
      "env": {
          "test": {
              "presets": [
                  "env",
                  "react"
              ],
              "plugins": [
                  "transform-class-properties",
                  "transform-object-rest-spread"
              ]
          }
      }
  }
  </code></pre>
    
    <p>jest.config.json</p>
  
  <pre><code>{
      "transform": {
          "^.+\\.jsx?$": "babel-jest"
      },
      "setupFiles": [
          "raf/polyfill",
          "&lt;rootDir&gt;/src/tests/setupTests.js"
      ],
      "snapshotSerializers": [
          "enzyme-to-json/serializer"
      ]
  }
  </code></pre>
    
    <p>package.json</p>
  
  <pre><code>{
    "scripts": {
      "build:prod": "webpack -p --env production",
      "build:dev": "webpack --env development",
      "dev-server": "webpack-dev-server",
      "test": "jest --config=jest.config.json"
    },
    "author": "Lukasz 'Severiaan' Grela",
    "dependencies": {
      "babel-core": "^6.26.0",
      "babel-loader": "^7.1.2",
      "babel-plugin-transform-class-properties": "^6.24.1",
      "babel-plugin-transform-object-rest-spread": "^6.26.0",
      "babel-preset-env": "^1.6.1",
      "babel-preset-react": "^6.24.1",
      "css-loader": "^0.28.9",
      "enzyme": "^3.3.0",
      "enzyme-adapter-react-16": "^1.1.1",
      "enzyme-to-json": "^3.3.1",
      "extract-text-webpack-plugin": "3.0.2",
      "jest": "^22.3.0",
      "node-sass": "^4.7.2",
      "raf": "^3.4.0",
      "react": "^16.2.0",
      "react-dom": "^16.2.0",
      "react-redux": "^5.0.7",
      "react-responsive": "^4.0.3",
      "react-router-dom": "^4.2.2",
      "react-scripts": "1.0.17",
      "redux": "^3.7.2",
      "redux-logger": "^3.0.6",
      "redux-promise": "^0.5.3",
      "sass-loader": "^6.0.6",
      "style-loader": "^0.20.2",
      "webpack": "^3.11.0",
      "webpack-dev-server": "^2.11.1"
    },
    "devDependencies": {
      "babel-jest": "^22.2.2"
    }
  }
  </code></pre>
  </blockquote>
  
  <p>What could be the problem, did anyone encounter similar problem? Thanks for any hints:)</p>