最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jestjs - Updating the `jsdom` version in `jest-environment-jsdom` - Stack Overflow

programmeradmin1浏览0评论

I'm currently using jsdom as my jest environment, with jest-environment-jsdom installed.

// jest.config.js
module.exports = {
  ...
  "testEnvironment": "jsdom"
}
// package.json
{
  "dependencies": {
    "jest": "29.6.2",
    "jest-environment-jsdom": "29.6.2"
  }
}

However, jest-environment-jsdom does not use the latest version of jsdom— currently it lists v20 while jsdom is up to v26.

I'm getting console errors when running jest about unsupported CSS (see ). This is fixed in [email protected].

Is there any supported way to use a specified version of jsdom in jest?


My current workaround is with pnpm overrides:

// package.json
{
  "pnpm": {
    "overrides": {
      "jest-environment-jsdom>jsdom": "^24.1.0"
    }
  },
}
发布评论

评论列表(0)

  1. 暂无评论