Skip to content

Commit

Permalink
fix: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dword-design committed Feb 27, 2021
1 parent 8e122f7 commit b915ecc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,25 @@ expect.extend({ toMatchImageSnapshot })
it('works', function () {
...
const screenshot = await puppeteer.screenshot()
expect(screenshot).toMatchSnapshot(this) // this is important here
expect(screenshot).toMatchImageSnapshot(this) // this is important here
});
```

Note that it is important to pass `this` to the matcher because it contains the test metadata.

It is also possible to configure default options:
To update existing snapshots, pass the environment variable `SNAPSHOT_UPDATE` into the process:

```bash
$ SNAPSHOT_UPDATE=true mocha
```

Additional options can be passed as a second argument (see [jest-image-snapshot docs](https://www.npmjs.com/package/jest-image-snapshot)):

```js
expect(screenshot).toMatchImageSnapshot(this, { dumpDiffToConsole: true })
```

It is also possible to configure default options (see [jest-image-snapshot docs](https://www.npmjs.com/package/jest-image-snapshot)):

```js
import { configureToMatchImageSnapshot } from 'expect-mocha-image-snapshot'
Expand All @@ -81,7 +93,6 @@ expect.extend({
}),
})
```
See the [jest-image-snapshot docs](https://www.npmjs.com/package/jest-image-snapshot) for details.

<!-- LICENSE/ -->
## License
Expand Down

0 comments on commit b915ecc

Please sign in to comment.