You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objects often contain variable data. Unfortunately, the current snapshot API requires "cleaning" these values out of the object before passing to toMatchSnapshot. This proposal is to give users the ability to specify the shape of the object in the snapshot.
Proposal
I propose that toMatchSnapshot accepts a new argument which is deeply merged into the received object before snapshotting. If the value of the merge object field is an asymmetric matcher, the matcher is verified and then the name of the matcher is used in the snapshot.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Motivation
Objects often contain variable data. Unfortunately, the current snapshot API requires "cleaning" these values out of the object before passing to
toMatchSnapshot
. This proposal is to give users the ability to specify the shape of the object in the snapshot.Proposal
I propose that
toMatchSnapshot
accepts a new argument which is deeply merged into the received object before snapshotting. If the value of the merge object field is an asymmetric matcher, the matcher is verified and then the name of the matcher is used in the snapshot.Example
Why core
This could be solved with a custom matcher. I think this should be in core because:
The text was updated successfully, but these errors were encountered: