Clear and concise description of the problem
As a developer using Vitest I want to read the current value of updateSnapshot in order to implement custom snapshot matchers following the update behavior of Vitests own snapshot matchers.
Suggested solution
Expose updateSnapshot as a public and typed property on SnapshotState, which can be accessed from Vitest matchers using expect.getState().snapshotState.
Currently, the value of updateSnapshot is only accessible through the internal property _updateSnapshot on snapshotState, which is not typed and can be subject to change.
Alternative
No response
Additional context
There is a related open issue regarding the --update flag, but is has a slightly different context and intention. That's why I opened a new issue. If you prefer, I'm open to add my request to the existing issue. In this case, you can close my request.
Validations
Clear and concise description of the problem
As a developer using Vitest I want to read the current value of
updateSnapshotin order to implement custom snapshot matchers following the update behavior of Vitests own snapshot matchers.Suggested solution
Expose
updateSnapshotas a public and typed property onSnapshotState, which can be accessed from Vitest matchers usingexpect.getState().snapshotState.Currently, the value of
updateSnapshotis only accessible through the internal property_updateSnapshotonsnapshotState, which is not typed and can be subject to change.Alternative
No response
Additional context
There is a related open issue regarding the
--updateflag, but is has a slightly different context and intention. That's why I opened a new issue. If you prefer, I'm open to add my request to the existing issue. In this case, you can close my request.Validations