Сбой теста JEST с помощью TypeError: environment.setup не является функцией

Lukasz 'Severiaan' Grela спросил: 03 февраля 2018 в 11:02 в: reactjs

Я пытаюсь добавить тесты в свое приложение, и тест завершился с ошибкой:

Не удалось запустить тестовый набор

TypeError: environment.setup is not a function  at node_modules/jest-runner/build/run_test.js:71:23

Ниже приведены мои файлы конфигурации, используемые в проекте:

.babelrc

{
    "presets": [
        "env",
        "react"
    ],
    "plugins": [
        "transform-class-properties",
        "transform-object-rest-spread"
    ],
    "env": {
        "test": {
            "presets": [
                "env",
                "react"
            ],
            "plugins": [
                "transform-class-properties",
                "transform-object-rest-spread"
            ]
        }
    }
}

jest.config.json

{
    "transform": {
        "^.+\\.jsx?$": "babel-jest"
    },
    "setupFiles": [
        "raf/polyfill",
        "<rootDir>/src/tests/setupTests.js"
    ],
    "snapshotSerializers": [
        "enzyme-to-json/serializer"
    ]
}

package.json

{
  "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"
  }
}

В чем может быть проблема: кто-нибудь сталкивался с подобной проблемой? Спасибо за любые подсказки:)

0 ответов