🌐
npm
npmjs.com › search
jsdom - npm search
A superset of the JSDOM environment for Jest that respects Node.js globals.
🌐
npm
npmjs.com › @zeromake › jest-environment-jsdom-with-canvas
@zeromake/jest-environment-jsdom-with-canvas - npm
This repository provides a Jest environment with the latest jsdom and node-canvas as of January, 2019.
      » npm install @zeromake/jest-environment-jsdom-with-canvas
    
Published   Aug 01, 2019
Version   0.1.1
🌐
GitHub
github.com › simon360 › jest-environment-jsdom-global › releases
Releases · simon360/jest-environment-jsdom-global
August 30, 2022 - A Jest environment that allows you to configure jsdom - simon360/jest-environment-jsdom-global
Author   simon360
🌐
npm
npmjs.com › package › @bufbuild › jest-environment-jsdom
@bufbuild/jest-environment-jsdom - npm
August 15, 2023 - A modern jsdom test environment for Jest. Latest version: 0.1.1, last published: 3 years ago. Start using @bufbuild/jest-environment-jsdom in your project by running `npm i @bufbuild/jest-environment-jsdom`. There are 0 other projects in the ...
      » npm install @bufbuild/jest-environment-jsdom
    
🌐
GitHub
github.com › jestjs › jest › issues › 12233
[Bug]: make jsdom accessible to extending environments again · Issue #12233 · jestjs/jest
January 13, 2022 - The error you get if you try to ... class 'JSDOMEnvironment'. jest-environment-jsdom-global (a popular npm package that uses the same technique to make jsdom available) is currently unaffected because it uses ......
Author   robin-drexler
🌐
npm
npmjs.com › package › jest-environment-jsdom
jest-environment-jsdom - npm
March 10, 2026 - Latest version: 30.3.0, last published: a month ago. Start using jest-environment-jsdom in your project by running `npm i jest-environment-jsdom`. There are 1454 other projects in the npm registry using jest-environment-jsdom.
      » npm install jest-environment-jsdom
    
Published   Mar 10, 2026
Version   30.3.0
🌐
npm
npmjs.com › package › jsdom
jsdom - npm
3 days ago - Note that in the default configuration, without setting runScripts, the values of window.Array, window.eval, etc. will be the same as those provided by the outer Node.js environment. That is, window.eval === eval will hold, so window.eval will not run scripts in a useful way. We strongly advise against trying to "execute scripts" by mashing together the jsdom and Node global environments (e.g.
      » npm install jsdom
    
Published   Apr 27, 2026
Version   29.1.0
🌐
Jest
jestjs.io › dom manipulation
DOM Manipulation · Jest
October 26, 2023 - Also, the function being tested adds an event listener on the #button DOM element, so we need to set up our DOM correctly for the test. jsdom and the jest-environment-jsdom package simulate a DOM environment as if you were in the browser.
🌐
GitHub
github.com › theneva › jest-environment-jsdom-thirteen
GitHub - theneva/jest-environment-jsdom-thirteen · GitHub
If you need a newer JSDOM than the one that ships with Jest, add this to your package.json: { // …, "jest": { // … "testEnvironment": "jest-environment-jsdom-thirteen", // …
Author   theneva
Find elsewhere
🌐
Vitest
vitest.dev › guide › environment
Test Environment | Guide | Vitest
March 4, 2026 - // @vitest-environment jsdom import { expect, test } from 'vitest' test('test', () => { expect(typeof window).not.toBe('undefined') })
🌐
Cugerone
morgan.cugerone.com › blog › quick-tip-jest-used-with-jsdom-as-environment-does-not-support-navigation-full-stop
Today I learned: Jest used with JSDOM as environment does not support navigation, full stop!
May 5, 2025 - JSDOM is not a Web Browser nor a Web driver and therefore has no primary interests on implementing Navigation. It emulates the DOM, what implies the current Document Object Model. Although it is also used for scraping websites, it expects its consumers to direct it to the pages to be scraped rather than offer crawling/navigation support.
🌐
GitHub
github.com › dmnsgn › jest-environment-jsdom-latest
GitHub - dmnsgn/jest-environment-jsdom-latest: Jest environment to use the latest jsdom API and features · GitHub
/** * @jest-environment jsdom-latest */ test('use the latest jsdom features in this test file', () => { const element = document.createElement('div'); expect(element).not.toBeNull(); });
Starred by 5 users
Forked by 4 users
Languages   JavaScript 78.1% | TypeScript 21.9%
🌐
Epic Web Dev
epicweb.dev › why-i-won-t-use-jsdom
Why I Won’t Use JSDOM | Epic Web Dev
January 28, 2025 - You are likely using JSDOM as a test environment. But you might remember me saying that it’s not a test environment, it is a library. What you are actually using in your tests is an environment created on top of this library, e.g. jest-environment-jsdom.
🌐
GitHub
github.com › nrwl › nx › issues › 12744
Missing jest-environment-jsdom dependency since jest 28 was introduced · Issue #12744 · nrwl/nx
October 21, 2022 - > NX ● Validation Error: Test environment jest-environment-jsdom cannot be found. Make sure the testEnvironment configuration option points to an existing node module. Configuration Documentation: https://jestjs.io/docs/configuration As of Jest 28 "jest-environment-jsdom" is no longer shipped by default, make sure to install it separately.
Author   mathis-m
🌐
GitHub
github.com › jsdom › jsdom › issues › 2119
Updating jsdom dependency in jest-environment-jsdom · Issue #2119 · jsdom/jsdom
January 22, 2018 - But jest-environment-jsdom still uses the faulty version of parse5 because it depends on jsdom@^11.5.1 which depends on the faulty version of parse5@^3.0.2.
Author   ryubro
🌐
npm
npmjs.com › package › @testing-library › jest-dom
@testing-library/jest-dom - npm
Custom jest matchers to test the state of the DOM. Latest version: 6.9.1, last published: 7 months ago. Start using @testing-library/jest-dom in your project by running `npm i @testing-library/jest-dom`. There are 20167 other projects in the npm registry using @testing-library/jest-dom.
      » npm install @testing-library/jest-dom
    
Published   Oct 01, 2025
Version   6.9.1
🌐
Snyk
security.snyk.io › snyk vulnerability database › npm
jest-environment-jsdom | Snyk
We found that jest-environment-jsdom demonstrates a positive version release cadence with at least one new version released in the past 3 months.
Top answer
1 of 4
222

In your package.json, or jest.config.js/jest.config.ts file, change the value of the testEnvironment property to jsdom.

package.json

"jest":{
    "testEnvironment": "jsdom"
}

jest.config.[js|ts]

module.exports = {
    "testEnvironment": "jsdom"
}

Important note for jest >28

If you are using jest 28, you will need to install jest-environment-jsdom separately by either:

npm: npm i jest-environment-jsdom --save-dev

yarn: yarn add -D jest-environment-jsdom

Why?

By default, jest uses the node testEnvironment. This essentially makes any tests meant for a browser environment invalid.

jsdom is an implementation of a browser environment, which supports these types of UI tests.

For Jest version 28 and greater, jest-environment-jsdom was removed from the default jest installation to reduce package size.

Additional reading

jest testEnvironment documentation

Jest 28 breaking changes

2 of 4
29

This can be solved on a per-test-file basis by adding a @jest-environment docblock to the beginning of your file. For example:

/** @jest-environment jsdom */
import React from 'react'
import { render } from '@testing-library/react'

import Button from '.'

describe('Button', () => {
  it('renders button without crashing', () => {
    const label = 'test'

    render(<Button label={label} />)
  })
})

If your project has a mix of UI and non-UI files, this is often preferable to changing the entire project by setting "testEnvironment": "jsdom" within your package.json or Jest config. By skipping initializing the JSDom environment for non-UI tests, Jest can run your tests faster. In fact, that's why Jest changed the default test environment in Jest 27.