Jest matcher for directory snapshot.
$ npm i --save-dev jest-dir-snapshot- Extend Jest's expect
const { toMatchDirSnapshot } = require('jest-dir-snapshot');
expect.extend({ toMatchDirSnapshot });- Use
toMatchDirSnapshot()in your tests!
expect({
'foo.js': 'foo',
}).toMatchDirSnapshot();toMatchDirSnapshottakes 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.