@@ -91,6 +91,28 @@ function toMatchDiffSnapshot(
91
91
return snapshot . toMatchSnapshot . call ( this , difference , testName || '' ) ;
92
92
}
93
93
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
+
94
116
function getSnapshotDiffSerializer ( ) {
95
117
return {
96
118
test ( value : any ) {
@@ -109,6 +131,7 @@ function setSerializers(customSerializers) {
109
131
module . exports = snapshotDiff ;
110
132
module . exports . snapshotDiff = snapshotDiff ;
111
133
module . exports . toMatchDiffSnapshot = toMatchDiffSnapshot ;
134
+ module . exports . toMatchInlineDiffSnapshot = toMatchInlineDiffSnapshot ;
112
135
module . exports . getSnapshotDiffSerializer = getSnapshotDiffSerializer ;
113
136
module . exports . setSerializers = setSerializers ;
114
137
module . exports . defaultSerializers = defaultSerializers ;
0 commit comments