@@ -91,6 +91,28 @@ function toMatchDiffSnapshot(
9191 return snapshot . toMatchSnapshot . call ( this , difference , testName || '' ) ;
9292}
9393
94+ function toMatchInlineDiffSnapshot (
95+ valueA : any ,
96+ valueB : any ,
97+ optionsOrSnapshot ?: Options | string ,
98+ inlineSnapshot ?: string
99+ ) {
100+ let options = undefined ;
101+ if ( typeof optionsOrSnapshot === 'string' ) {
102+ inlineSnapshot = optionsOrSnapshot ;
103+ } else {
104+ options = optionsOrSnapshot ;
105+ }
106+
107+ const difference = snapshotDiff ( valueA , valueB , options ) ;
108+
109+ if ( inlineSnapshot ) {
110+ return snapshot . toMatchInlineSnapshot . call ( this , difference, inlineSnapshot) ;
111+ } else {
112+ return snapshot . toMatchInlineSnapshot . call ( this , difference )
113+ }
114+ }
115+
94116function getSnapshotDiffSerializer ( ) {
95117 return {
96118 test ( value : any ) {
@@ -109,6 +131,7 @@ function setSerializers(customSerializers) {
109131module . exports = snapshotDiff ;
110132module . exports . snapshotDiff = snapshotDiff ;
111133module . exports . toMatchDiffSnapshot = toMatchDiffSnapshot ;
134+ module . exports . toMatchInlineDiffSnapshot = toMatchInlineDiffSnapshot ;
112135module . exports . getSnapshotDiffSerializer = getSnapshotDiffSerializer ;
113136module . exports . setSerializers = setSerializers ;
114137module . exports . defaultSerializers = defaultSerializers ;
0 commit comments