将 Jest 升级到 v28 - 找不到错误测试环境 jest-environment-jsdom

Upgrading Jest to v28 - Error Test environment jest-environment-jsdom cannot be found

有没有人成功升级到最新的 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.

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