Home

Awesome

jest-large-snapshot-warning

Add warnings to large snapshots!

Setup

# install
yarn add --dev jest-large-snapshot-warning
// my.test.js
import "jest-large-snapshot-warning";

test("large snapshot", () => {
  expect(/* large object */).toMatchSnapshot();
});

setMaxSnapshotSize

The default max size is 50.

// my.test.js
import { setMaxSnapshotSize } "jest-large-snapshot-warning";

setMaxSnapshotSize(10);

test("large snapshot", () => {
  expect(/* large object */).toMatchSnapshot();
});

setupFiles

To setup a max snapshot size for all test suites, use the setupFiles option in your jest config.

// setupTest.js
import { setMaxSnapshotSize } "jest-large-snapshot-warning";

setMaxSnapshotSize(10);
{
  "setupFiles": ["./setupTest.js"]
}