开玩笑-TypeError:Object(...)不是一个函数

时间:2019-03-03 19:01:13

标签: javascript jestjs

我刚刚开始编写一些集成测试,但是Jest似乎抛出了此错误:

tidee-air:tidee-life-web joe$ npx jest login-page.integration.test.js
 FAIL  src/pages/login/__tests__/login-page.integration.test.js
  ● Test suite failed to run

    TypeError: Object(...) is not a function

      93 |  * Copyright (c) 2014-2017, Jon Schlinkert.
      94 |  * Released under the MIT License.
      ...

当我也使用Webpack构建应用程序时,没有错误。我一直在寻找答案,并在jest配置的@babel/polyfill部分中添加了setupFiles,但这没有任何区别。我真的不确定现在该怎么办。

1 个答案:

答案 0 :(得分:0)

设置断点是您现在可以做的一件事,以收集更多信息。 https://jestjs.io/docs/en/troubleshooting#tests-are-failing-and-you-don-t-know-why建议像这样开玩笑

Y.toFixed(0);

在devtools中启用“暂停例外”非常有用。

相关问题