Jest 28, released on April 25, 2022, stops including jest-environment-jsdom in its default installation. Teams whose tests need a browser-like environment must install that package explicitly rather than rely on Jest to bring it along. The same packaging change affects jest-jasmine2, the older test runner. Neither package is abandoned: the project says both remain actively maintained and tested. [S1]

The environment switch happened earlier. Jest 27 changed the default test environment from jsdom to node in May 2021. Its announcement warned that tests using browser document APIs without an explicit environment setting could fail when they accessed document. The documented remedy was to select testEnvironment: "jsdom", either for the project or through per-file configuration. Jest 28 adds an installation requirement to that configuration choice; an existing jsdom setting does not replace the need to install its environment package. [S1][S2]

For an upgrade, check the selected environment against the installed dependencies. A suite already configured for jsdom after the Jest 27 change may need a dependency update without another environment switch. A suite moving from an older default configuration needs both choices examined. Neither announcement says every test suite needs jsdom. [S1][S2]

For mixed projects, Jest’s maintainers recommend keeping node as the default environment and marking only the test files that need the Document Object Model, or DOM, for jsdom. Installing the environment package need not mean using it for every test. [S2][S1]

The Jasmine decision is separate. Jest 27 made jest-circus the default runner and warned that code using Jasmine-specific APIs, such as jasmine.getEnv(), could need attention. Its documented fallback was testRunner: "jest-jasmine2". Under Jest 28, teams retaining that runner must explicitly install jest-jasmine2 as well. Selecting jsdom supplies the environment; it does not select the Jasmine runner. A browser-oriented suite is not, by that fact alone, a reason to reinstall both removed packages. [S1][S2]

Adding those dependencies is not a complete Jest 28 migration. The release also drops support for Node 10 and 15 and renames some configuration options. Teams consuming Jest’s component packages directly, such as jest-worker or pretty-format, are told to inspect the changelog for their breaking changes rather than rely only on the general upgrade guide. [S1]

Source documents

  1. Jest 28: Shedding weight and improving compatibilityhttps://jestjs.io/blog/2022/04/25/jest-28
  2. Jest 27: New Defaults for Jest, 2021 editionhttps://jestjs.io/blog/2021/05/25/jest-27