Closed
Description
First of all I would like to thank you for your work!
It allowed me to decreased snapshot file size from 10k lines to 1.3k!
Add custom matcher
e.g. https://github.com/americanexpress/jest-image-snapshot#usage
See https://facebook.github.io/jest/docs/expect.html#expectextendmatchers
Usage:
expect(nextState).toMatchDiffSnapshot(prevState, { contextLines: 2 })
Add snapshot serializer based on input type
e.g. https://github.com/prettier/prettier/blob/master/tests_config/raw-serializer.js
Current output for object diffs is too noisy, so I had do implement custom serializer in my project, and now output changed from:
Object {
\\"bail\\": false,
\\"context\\": \\".\\",
\\"devServer\\": Object {
\\"disableHostCheck\\": true,
- \\"host\\": \\"localhost\\",
+ \\"host\\": \\"local.host\\",
\\"hotOnly\\": true,
\\"inline\\": true,
\\"noInfo\\": true,
\\"overlay\\": Object {
\\"errors\\": true,
\\"warnings\\": true,
},
\\"port\\": 3000,
To:
Object {
"bail": false,
"context": ".",
"devServer": Object {
"disableHostCheck": true,
- "host": "localhost",
+ "host": "local.host",
"hotOnly": true,
"inline": true,
"noInfo": true,
"overlay": Object {
"errors": true,
"warnings": true,
},
"port": 3000,
I would love to add PR with this changes.
Metadata
Metadata
Assignees
Labels
No labels