#### 1. Add Package ```typescript yarn add enzyme-dive --dev ```
npm install enzyme-diveππΌββ Dive deepοΈ
#### 1. Add Package
``typescript`
yarn add enzyme-dive --dev
#### 2. Extend Enzyme in your setup file
`typescript
import * as Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-xx';
import configure from "enzyme-dive";
Enzyme.configure({ adapter: new Adapter() });
// The magic π§πΌββοΈ
configure(Enzyme.ShallowWrapper);
`
typescript
import React from 'react';
import { shallow } from "enzyme";
import Component from './Component';
import ChildComponent from './ChildComponent';describe(' ', function() {
it("should render child", () => {
const wrapper = shallow( ).diveTo(ChildComponent);
expect(wrapper).toMatchSnapshot();
});
});
`
---
$3
Dive through your nodes a specified amount
`typescript
import React from 'react';
import { shallow } from "enzyme";
import Component from './Component';describe(' ', function() {
it("should render", () => {
// const wrapper = shallow( ).dive().dive().dive().dive().dive();
const wrapper = shallow( ).diveDeep(5);
expect(wrapper).toMatchSnapshot();
});
});
``