Skip to content

Commit

Permalink
fix: remove extend-expect (#70)
Browse files Browse the repository at this point in the history
* Use extend-expect directly from jest-dom

* Move jest-dom to devDependencies

BREAKING CHANGE: dom-testing-library no longer exposes the extend-expect module. Replace anywhere you're using `'dom-testing-library/extend-expect'` with `'jest-dom/extend-expect'` 👍
  • Loading branch information
gnapse authored and Kent C. Dodds committed Jul 10, 2018
1 parent ec672a6 commit 7f99fb8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ import {
wait,
} from 'dom-testing-library'
// adds special assertions like toHaveTextContent and toBeInTheDOM
import 'dom-testing-library/extend-expect'
import 'jest-dom/extend-expect'

function getExampleDOM() {
// This is just a raw example of setting up some DOM
Expand Down Expand Up @@ -534,13 +534,13 @@ finding elements in the DOM similarly to how users would do.

## Custom Jest Matchers

When using [jest][], we recommend that you import a set of custom matchers that
make it easier to check several aspects of the state of a DOM element. These are
provided by [jest-dom](https://github.com/gnapse/jest-dom), but are also
included for convenience to be imported from this library directly:
When using [jest][], it is convenient to import a set of custom matchers that
make it easier to check several aspects of the state of a DOM element. For
exmaple, you can use the ones provided by
[jest-dom](https://github.com/gnapse/jest-dom):

```javascript
import 'dom-testing-library/extend-expect'
import 'jest-dom/extend-expect'
// <span data-testid="greetings">Hello World</span>
expect(queryByTestId(container, 'greetings')).toBeInTheDOM()
Expand Down
2 changes: 0 additions & 2 deletions extend-expect.js

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@
},
"files": [
"dist",
"typings",
"extend-expect.js"
"typings"
],
"dependencies": {
"jest-dom": "^1.0.0",
"pretty-format": "^22.4.3",
"mutationobserver-shim": "^0.3.2",
"wait-for-expect": "^0.4.0"
},
"devDependencies": {
"dtslint": "^0.3.0",
"jest-dom": "^1.7.0",
"jest-in-case": "^1.0.2",
"kcd-scripts": "^0.37.0",
"microbundle": "^0.4.4"
Expand Down

0 comments on commit 7f99fb8

Please sign in to comment.