Babel 7 Jest Core JS Typeerror WKS не является функцией - PullRequest
0 голосов
/ 19 сентября 2018

После обновления моего проекта до Babel 7, выполнение тестов через jest приводит к следующей ошибке.Тесты раньше выполнялись без каких-либо проблем в Babel 6, но не выполняются в Babel 7 со следующей ошибкой

TypeError: wks is not a function

  at Object.<anonymous>.module.exports (node_modules/core-js/modules/_fix-re-wks.js:16:16)
  at Object.<anonymous> (node_modules/core-js/modules/es6.regexp.replace.js:4:25)
  at Object.<anonymous> (node_modules/core-js/modules/es6.regexp.split.js:3:1)
  at Object.<anonymous> (node_modules/core-js/modules/es6.symbol.js:7:1)
  at Object.<anonymous> (node_modules/core-js/modules/_is-object.js:5:1)
  at Object.<anonymous> (node_modules/core-js/modules/_inherit-if-required.js:3:16)
  at Object.<anonymous> (node_modules/core-js/modules/es6.regexp.constructor.js:5:25)
  at Object.<anonymous> (node_modules/core-js/modules/es6.regexp.match.js:3:1)
  at Object.<anonymous> (node_modules/core-js/modules/es6.function.name.js:3:1)
  at Object.<anonymous> (node_modules/core-js/modules/_wks.js:3:1)
  at Object.<anonymous> (node_modules/core-js/modules/_add-to-unscopables.js:4:19)
  at Object.<anonymous> (node_modules/core-js/modules/es6.array.iterator.js:3:24)
  at Object.<anonymous> (node_modules/core-js/modules/web.dom.iterable.js:3:18)
  at Object.<anonymous> (node_modules/regenerator-runtime/runtime.js:3:1)

Jest config

{
"unmockedModulePathPatterns": [
  "<rootDir>/node_modules/react",
  "<rootDir>/node_modules/react-dom",
  "<rootDir>/node_modules/react-addons-test-utils",
  "<rootDir>/node_modules/fbjs",
  "enzyme"
],
"roots": [
  "<rootDir>/__tests__"
],
"transformIgnorePatterns": [
  "node_modules/(^generic-)/i", //a module matching this is throwing an error
  "node_modules/react-infinite-scroller"
],
"setupFiles": [
  "./jestsetup.js"
],
"snapshotSerializers": [
  "enzyme-to-json/serializer"
],
"testResultsProcessor": "./jestTrxProcessor",
"verbose": true
  }

babel.js.config

{
"presets": [
    [
        "@babel/preset-env",
        {
            "targets": {
                "ie": 11
            },
            "useBuiltIns": "usage"
        }
    ],
    "@babel/preset-react"
],
"plugins": [
    "@babel/plugin-transform-runtime",
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-syntax-import-meta",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-json-strings",
    [
        "@babel/plugin-proposal-decorators",
        {
            "legacy": true
        }
    ],
    "@babel/plugin-proposal-function-sent",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-proposal-numeric-separator",
    "@babel/plugin-proposal-throw-expressions",
    "@babel/plugin-proposal-object-rest-spread",
    "@babel/plugin-transform-object-assign"
    ]
}

package.json

"devDependencies": {
    "@babel/cli": "^7.0.0",
    "@babel/core": "^7.0.1",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-function-sent": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-numeric-separator": "^7.0.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/plugin-transform-object-assign": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-loader": "^8.0.0",
    "body-parser": "^1.18.3",
    "create-if-not-exist": "^0.0.2",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "enzyme-to-json": "^3.3.1",
    "eslint": "^4.13.1",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-config-defaults": "^9.0.0",
    "eslint-config-rallycoding": "^3.2.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^6.0.2",
    "eslint-plugin-react": "^7.4.0",
    "exports-loader": "0.6.4",
    "express": "^4.16.3",
    "generic-redux-root": "^0.0.1",
    "imports-loader": "0.7.1",
    "jasmine": "^2.8.0",
    "jest": "^23.4.1",
    "jest-cli": "^23.4.1",
    "jest-trx-results-processor": "^0.0.7",
    "redux-mock-store": "^1.5.1",
    "string-replace-webpack-plugin": "^0.1.3",
    "webpack": "^4.5.0",
    "webpack-cli": "^2.0.12",
    "webpack-dev-server": "^3.1.1"
  },
  "dependencies": {
    "@babel/polyfill": "^7.0.0",
    "babel-jest": "^23.6.0",
    "babel-plugin-add-module-exports": "^0.2.1",
    "core-js": "^2.5.5",
    "draft-js": "^0.10.5",
    "es6-promise": "^3.3.1",
    "flux": "^3.1.3",
    "generic-api-fetch": "1.0.1",
    "generic-http": "^1.0.2",
    "generic-limited-textarea": "^1.1.0",
    "generic-select": "^1.0.3",
    "generic-throttled-select": "^1.0.3",
    "lodash": "4.17.4",
    "moment": "^2.22.2",
    "prop-types": "^15.6.2",
    "react": "16.2.0",
    "react-addons-update": "15.6.2",
    "react-datepicker": "^1.5.0",
    "react-dom": "16.2.0",
    "react-hot-loader": "3.1.3",
    "react-infinite-scroller": "^1.2.0",
    "react-redux": "5.0.6",
    "react-select": "1.1.0",
    "redux": "3.7.2",
    "redux-logger": "3.0.6",
    "redux-thunk": "2.2.0",
    "reselect": "3.0.1",
    "whatwg-fetch": "^2.0.4"
  }

Что я делаю не так?

...