# jest-environment-enzyme

> Runtime Environment for enzyme tests in jest

Latest version **7.1.2** (published 2019-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-environment-enzyme
pnpm add jest-environment-enzyme
yarn add jest-environment-enzyme
bun add jest-environment-enzyme
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.1.2 |
| Published | 2019-10-29 |
| First published | 2018-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 886 |
| Author | Blaine Kasten |
| Maintainers | blainekasten |
| Keywords | javascript, shallow rendering, shallowRender, test, reactjs, react, flux, testing, test utils, assertion helpers, tdd, jest, enzyme |

## Links

- npm: https://www.npmjs.com/package/jest-environment-enzyme
- Repository: https://github.com/FormidableLabs/enzyme-matchers
- Homepage: https://github.com/FormidableLabs/enzyme-matchers/blob/master/packages/jest-environment-enzyme#readme
- Issues: https://github.com/FormidableLabs/enzyme-matchers/issues
- npm.io page: https://npm.io/package/jest-environment-enzyme

## Dependencies (1)

- [jest-environment-jsdom](https://npm.io/package/jest-environment-jsdom.md) ^24.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 7.1.2 (latest) — 2019-10-29
- 7.1.1 — 2019-09-04
- 7.1.0 — 2019-08-06
- 7.0.2 — 2019-03-07
- 7.0.1 — 2018-11-03
- 7.0.0 — 2018-10-08
- 6.1.2 — 2018-09-21
- 6.1.1 — 2018-09-21
- 6.1.0 — 2018-09-20
- 6.0.5 — 2018-09-20
- 6.0.4 — 2018-08-27
- 6.0.3 — 2018-08-08
- 6.0.2 — 2018-06-20
- 6.0.1 — 2018-05-24
- 6.0.0 — 2018-03-13
- … 4 more at https://npm.io/package/jest-environment-enzyme/versions

## README

# jest-environment-enzyme

[![npm version](https://img.shields.io/npm/v/jest-environment-enzyme.svg)](https://www.npmjs.com/package/jest-environment-enzyme)
![License](https://img.shields.io/npm/l/chai-enzyme.svg)

### Overview

Setting up Enzyme with Jest and React is a somewhat complicated process. There are a lot of dependencies, configuring adapters, etc. This module will take lessen that setup and make it more declarative.
This package will also simplify your test files by declaring React, and enzyme wrappers in the global scope. This means that all of your test files don't need to include imports for React or enzyme.

The setup can be as simple as this:

```
yarn add jest-environment-enzyme jest-enzyme enzyme-adapter-react-* --dev
```

> (Where * is your app's adapter that matches your React version)

For example, if you are using react-16, it should look like:

```
yarn add jest-environment-enzyme jest-enzyme enzyme-adapter-react-16 --dev
```

```js
// package.json
"jest": {
  "setupFilesAfterEnv": ["jest-enzyme"],
  "testEnvironment": "enzyme"
}
```

Additionally, you can specify which enzyme adapter you want to use through the `testEnvironmentOptions.enzymeAdapter`.

Valid options are:

* `react13`
* `react14`
* `react15`
* `react15.4`
* `react16` (default)

```js
// package.json
"jest": {
  "setupFilesAfterEnv": ["jest-enzyme"],
  "testEnvironment": "enzyme",
  "testEnvironmentOptions": {
    "enzymeAdapter": "react16"
  }
}
```

*Lastly, and _most importantly_*, this library has a hard requirement on `jest-enzyme`.

---
_Source: https://npm.io/package/jest-environment-enzyme · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
