Skip to content

Use extend-expect directly from jest-dom #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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