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
it('should make sure the return value doesnt change',async()=>{constresultPre=getResult()expect(resultPre).to.matchSnapshot()awaitrunSomeSideEffect()constresultPost=getResult()expect(resultPost).to.matchSnapshot()})
exports['should make sure the return value doesnt change 1']= ...
exports['should make sure the return value doesnt change 2']= ...
This works fine by ensuring that the snapshots do not change, but it duplicates what is the same output and gives a slightly misleading error if it fails.
It would be great if there was a way to specify reusing the same snapshot in different places. For example:
import{createSnapshotKey}from'chai-jest-snapshot'constsnapshotKey=createShapshotKey()it('should make sure the return value doesnt change',()=>{
...
expect(resultPre).to.matchSnapshot(snapshotKey)...expect(resultPost).to.matchSnapshot(snapshotKey)// both reference exports['should make sure the return value doesnt change 1']=...})
The text was updated successfully, but these errors were encountered:
it('should make sure the return value doesnt change',async()=>{constresultPre=getResult()expect(resultPre).to.matchSnapshot()awaitrunSomeSideEffect()constresultPost=getResult()expect(resultPost).to.deep.equal(resultPre)})
Im closing this now, but feel free to open it again if there is anything else to discuss
I have a use case like so:
This works fine by ensuring that the snapshots do not change, but it duplicates what is the same output and gives a slightly misleading error if it fails.
It would be great if there was a way to specify reusing the same snapshot in different places. For example:
The text was updated successfully, but these errors were encountered: