0.1.0 • Published 5 years ago

jest-large-snapshot-warning v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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"]
}