Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
chore: remove Enzyme example (jestjs#14119)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored May 2, 2023
1 parent 2492231 commit fcb1c34
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 621 deletions.
35 changes: 2 additions & 33 deletions docs/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [@testing-library/react](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following example use `@testing-library/react`.

#### react-testing-library
#### @testing-library/react

```bash npm2yarn
npm install --save-dev @testing-library/react
Expand Down Expand Up @@ -261,37 +261,6 @@ it('CheckboxWithLabel changes the text after click', () => {
The code for this example is available at [examples/react-testing-library](https://github.com/facebook/jest/tree/main/examples/react-testing-library).
#### Enzyme
```bash npm2yarn
npm install --save-dev enzyme
```
If you are using a React version below 15.5.0, you will also need to install `react-addons-test-utils`.
Let's rewrite the test from above using Enzyme instead of react-testing-library. We use Enzyme's [shallow renderer](https://enzymejs.github.io/enzyme/docs/api/shallow.html) in this example.
```tsx title="__tests__/CheckboxWithLabel-test.js"
import Enzyme, {shallow} from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import CheckboxWithLabel from '../CheckboxWithLabel';
Enzyme.configure({adapter: new Adapter()});
it('CheckboxWithLabel changes the text after click', () => {
// Render a checkbox with label in the document
const checkbox = shallow(<CheckboxWithLabel labelOn="On" labelOff="Off" />);
expect(checkbox.text()).toBe('Off');
checkbox.find('input').simulate('change');
expect(checkbox.text()).toBe('On');
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
8 changes: 0 additions & 8 deletions examples/enzyme/.babelrc.js

This file was deleted.

28 changes: 0 additions & 28 deletions examples/enzyme/CheckboxWithLabel.js

This file was deleted.

18 changes: 0 additions & 18 deletions examples/enzyme/__tests__/CheckboxWithLabel-test.js

This file was deleted.

21 changes: 0 additions & 21 deletions examples/enzyme/package.json

This file was deleted.

4 changes: 1 addition & 3 deletions website/versioned_docs/version-25.x/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -276,8 +276,6 @@ test('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-26.x/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -276,8 +276,6 @@ test('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-27.x/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -276,8 +276,6 @@ test('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-28.x/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-29.0/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-29.1/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-29.2/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-29.3/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-29.4/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-29.5/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ React 16 triggers these warnings due to how it checks element types, and the moc
### DOM Testing
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/kentcdodds/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.
If you'd like to assert, and manipulate your rendered components you can use [react-testing-library](https://github.com/testing-library/react-testing-library), [Enzyme](https://enzymejs.github.io/enzyme/), or React's [TestUtils](https://reactjs.org/docs/test-utils.html). The following two examples use react-testing-library and Enzyme.

#### react-testing-library

Expand Down Expand Up @@ -290,8 +290,6 @@ it('CheckboxWithLabel changes the text after click', () => {
});
```
The code for this example is available at [examples/enzyme](https://github.com/facebook/jest/tree/main/examples/enzyme).
### Custom transformers
If you need more advanced functionality, you can also build your own transformer. Instead of using `babel-jest`, here is an example of using `@babel/core`:
Expand Down
Loading

0 comments on commit fcb1c34

Please sign in to comment.