【问题标题】:Upgrading Jest to v29 - Error Test environment jest-environment-jsdom cannot be found将 Jest 升级到 v28 - 找不到测试环境 jest-environment-jsdom 错误
【发布时间】:2022-06-19 19:17:34
【问题描述】:

有没有人成功升级到最新的 Jest 版本28.0.0
我收到一个错误:

Error: Test environment jest-environment-jsdom cannot be found. Make sure the testEnvironment configuration option points to an existing node module.

【问题讨论】:

    标签: javascript node.js typescript jestjs ts-jest


    【解决方案1】:

    Jest 团队在 28.0.1 版本中添加了更多 descriptive error message

    Error: ...
    As of Jest 28 "jsdom" is no longer shipped by default, make sure to install it separately.
    

    安装jsdom 包解决了这个问题:
    npm install --save-dev jest-environment-jsdom

    【讨论】:

    【解决方案2】:

    安装jest环境jsdom解决了这个问题:

    纱线添加 jest-environment-jsdom

    【讨论】:

      猜你喜欢
      • 2022-07-10
      • 2022-11-10
      • 2021-10-05
      • 1970-01-01
      • 2019-12-02
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多