jest-environment-jsdom-latest

[![npm version](https://img.shields.io/npm/v/jest-environment-jsdom-latest)](https://www.npmjs.com/package/jest-environment-jsdom-latest) [![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)](https://www.npmjs.com/package/jest-env

Usage no npm install needed!

<script type="module">
  import jestEnvironmentJsdomLatest from 'https://cdn.skypack.dev/jest-environment-jsdom-latest';
</script>

README

jest-environment-jsdom-latest

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Jest environment to use the latest jsdom API and features.

paypal coinbase twitter

Installation

npm install jest-environment-jsdom-latest

Usage

In index.spec.js or whatever:

/**
 * @jest-environment jsdom-latest
 */

test('use the latest jsdom features in this test file', () => {
  const element = document.createElement('div');
  expect(element).not.toBeNull();
});

Motivation

As of v10, jsdom has a new API and some cool new features. The downside is that now it requires a Node version >= 6.

As stated in the Jest documentation (here), the minimum supported Node version is v4.0.0.

This package helps you if you are running on Node >= 6 and want to use the latest JSDOM features. It will be deprecated when Jest drops Node 4 and Node 5 support.

The build script is as close as possible from the one of Facebook's Jest repo. More on Jest environments: http://facebook.github.io/jest/docs/configuration.html#testenvironment-string

License

MIT. See license file.