Skip to content
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

Add extend-expect file #44

Merged
merged 1 commit into from
Sep 4, 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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ it('should demonstrate this matcher`s usage', async () => {

![Screenshot of the resulting output from the usage example](example-cli.png)

> Note, you can also simply require `'jest-axe/extend-expect'` which will call `expect.extend` for you.
> This is especially helpful when using the jest `setupFiles` configuration.

### With React

```javascript
Expand Down
8 changes: 8 additions & 0 deletions extend-expect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// this allows users to simply add `require('jest-axe/extend-expect')`
// at the top of their test file rather than have two lines for this.
// it also allows users to use jest's setupFiles configuration and
// point directly to `jest-axe/extend-expect`
const { toHaveNoViolations } = require('jest-axe')

expect.extend(toHaveNoViolations)

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"repository": "nickcolley/jest-axe",
"main": "index.js",
"files": [
"index.js"
"index.js",
"extend-expect.js"
],
"scripts": {
"test": "jest"
Expand Down