1.0.0 • Published 4 years ago

jest-dir-snapshot v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

jest-dir-snapshot

Jest matcher for directory snapshot.

Usage

Installation

$ npm i --save-dev jest-dir-snapshot

Invocation

  1. Extend Jest's expect
const { toMatchDirSnapshot } = require('jest-dir-snapshot');

expect.extend({ toMatchDirSnapshot });
  1. Use toMatchDirSnapshot() in your tests!
expect({
  'foo.js': 'foo',
}).toMatchDirSnapshot();

API

  • toMatchDirSnapshot takes an optional options object with the following properties:
    • snapshotsDir: A custom absolute path of a directory to keep this snapshot in.
    • snapshotIdentifier: A custom name to give this snapshot. If not provided one is computed automatically.

License

MIT