enzyme-cleanup

1.1.2 • Public • Published

enzyme-cleanup

Purpose

To be able to provide a quick utility to unmount enzyme tests.

See this issue for more information.

To install

npm i -D eynzme-cleanup 
# or yarn add -D eynzme-cleanup

Then, add this to your jest setup script.

import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { cleanup, makeAdapter } from 'enzyme-cleanup'

// afterEach is a global jest method
afterEach(cleanup)

configure({ adapter: makeAdapter(Adapter) })

If you are not using jest, you can call enzymeCleanup() however you see fit.

Can be used with any enzyme adapter.

Works on shallow, mount, or render wrappers of enzyme.

Package Sidebar

Install

npm i enzyme-cleanup

Weekly Downloads

264

Version

1.1.2

License

ISC

Unpacked Size

3.82 kB

Total Files

5

Last publish

Collaborators

  • cgood92