Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jomaxx/jest-large-snapshot-warning
Add warnings to large snapshots!
https://github.com/jomaxx/jest-large-snapshot-warning
Last synced: 3 months ago
JSON representation
Add warnings to large snapshots!
- Host: GitHub
- URL: https://github.com/jomaxx/jest-large-snapshot-warning
- Owner: jomaxx
- Created: 2019-06-15T01:33:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T00:41:23.000Z (almost 2 years ago)
- Last Synced: 2024-07-12T17:56:02.552Z (4 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/jest-large-snapshot-warning
- Size: 854 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-jest - jest-large-snapshot-warning
README
# jest-large-snapshot-warning
Add warnings to large snapshots!
## Setup
```bash
# install
yarn add --dev jest-large-snapshot-warning
``````js
// my.test.js
import "jest-large-snapshot-warning";test("large snapshot", () => {
expect(/* large object */).toMatchSnapshot();
});
```### setMaxSnapshotSize
The default max size is `50`.
```js
// 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](https://jestjs.io/docs/en/configuration.html#setupfiles-array) option in your jest config.
```js
// setupTest.js
import { setMaxSnapshotSize } "jest-large-snapshot-warning";setMaxSnapshotSize(10);
``````json
{
"setupFiles": ["./setupTest.js"]
}
```