【问题标题】:Should I use jest or jest-cli on a react native project from scratch?我应该从头开始在反应本机项目上使用 jest 还是 jest-cli ?
【发布时间】:2017-12-10 21:31:05
【问题描述】:

从头开始创建 react-native 项目时,我在 devDependencies 中得到了 jest 并且测试通过了!

但现在我在做测试时得到了:

(node:32629) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '.../node_modules/jest-cli'
(node:32629) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我应该使用 jest 还是 jest-cli?

【问题讨论】:

    标签: node.js reactjs react-native jestjs


    【解决方案1】:

    没有更多信息很难知道,但可能是您全局安装的jest 比您的packages.json 版本旧。

    尝试从您的项目目录运行以下命令并比较结果:

    jest --version
    npm exec jest --version
    

    还可以尝试运行npm exec jest,因为它会使用您本地安装的版本运行开玩笑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-04
      • 1970-01-01
      • 2018-07-14
      • 2022-12-14
      • 1970-01-01
      • 1970-01-01
      • 2013-03-21
      • 1970-01-01
      相关资源
      最近更新 更多