使用babel运行jest时的TypeError

时间:2016-07-03 23:15:39

标签: javascript reactjs babeljs jestjs

当我运行测试时,出现以下错误:

TypeError: (0 , _shouldUpdate2.default) is not a function
        at Object.<anonymous> (node_modules/recompose/pure.js:19:39)
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:352:17)
        at Runtime.requireModule (node_modules/jest-runtime/build/index.js:202:14)
        at Runtime._generateMock (node_modules/jest-runtime/build/index.js:418:34)
        at Runtime.requireMock (node_modules/jest-runtime/build/index.js:256:43)
        at Runtime.requireModuleOrMock (node_modules/jest-runtime/build/index.js:264:19)
        at Object.<anonymous> (node_modules/material-ui/svg-icons/navigation/expand-less.js:11:13)
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:352:17)
        at Runtime.requireModule (node_modules/jest-runtime/build/index.js:202:14)
        at Runtime._generateMock (node_modules/jest-runtime/build/index.js:418:34)
        at Runtime.requireMock (node_modules/jest-runtime/build/index.js:256:43)
        at Runtime.requireModuleOrMock (node_modules/jest-runtime/build/index.js:264:19)
        at Object.<anonymous> (node_modules/material-ui/List/ListItem.js:41:19)
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:352:17)
        at Runtime.requireModule (node_modules/jest-runtime/build/index.js:202:14)
        at Runtime._generateMock (node_modules/jest-runtime/build/index.js:418:34)
        at Runtime.requireMock (node_modules/jest-runtime/build/index.js:256:43)
        at Runtime.requireModuleOrMock (node_modules/jest-runtime/build/index.js:264:19)
        at Object.<anonymous> (node_modules/material-ui/List/index.js:12:18)
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:352:17)
        at Runtime.requireModule (node_modules/jest-runtime/build/index.js:202:14)
        at Runtime._generateMock (node_modules/jest-runtime/build/index.js:418:34)
        at Runtime.requireMock (node_modules/jest-runtime/build/index.js:256:43)
        at Runtime.requireModuleOrMock (node_modules/jest-runtime/build/index.js:264:19)
        at Object.<anonymous> (js/components/structure/SideNav.js:3:39)
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:352:17)
        at Runtime.requireModule (node_modules/jest-runtime/build/index.js:202:14)
        at Runtime.requireModuleOrMock (node_modules/jest-runtime/build/index.js:266:19)
        at Object.<anonymous> (js/components/structure/__tests__/SideNav.js:6:42)
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:352:17)
        at Runtime.requireModule (node_modules/jest-runtime/build/index.js:202:14)
        at jasmine2 (node_modules/jest-jasmine2/build/index.js:287:16)
        at Test.run (node_modules/jest-cli/build/Test.js:50:12)
        at promise.then.then.data (node_modules/jest-cli/build/TestRunner.js:255:62)
        at process._tickCallback (internal/process/next_tick.js:103:7)

这是我的jest配置,取自package.json:

"jest": {
    "testRegex": ".*/__tests__/.*\\.js",
    "unmockedModulePathPatterns": [
      "<rootDir>/node_modules/react/",
      "<rootDir>/node_modules/react-dom/",
      "<rootDir>/node_modules/react-addons-test-utils/"
    ]
  }

这是我的.babelrc:

{
  "presets": [
    "react",
    "es2015"
  ]
}

0 个答案:

没有答案