@@ -42,12 +42,12 @@ export default class SnapshotState {
4242 private _index : number ;
4343 private _updateSnapshot : Config . SnapshotUpdateState ;
4444 private _snapshotData : SnapshotData ;
45+ private _initialData : SnapshotData ;
4546 private _snapshotPath : Config . Path ;
4647 private _inlineSnapshots : Array < InlineSnapshot > ;
4748 private _uncheckedKeys : Set < string > ;
4849 private _getBabelTraverse : ( ) => Function ;
4950 private _getPrettier : ( ) => null | any ;
50- private _reinitializeData : ( ) => void ;
5151
5252 added : number ;
5353 expand : boolean ;
@@ -61,7 +61,7 @@ export default class SnapshotState {
6161 this . _snapshotPath ,
6262 options . updateSnapshot ,
6363 ) ;
64-
64+ this . _initialData = data ;
6565 this . _snapshotData = data ;
6666 this . _dirty = dirty ;
6767 this . _getBabelTraverse = options . getBabelTraverse ;
@@ -76,17 +76,6 @@ export default class SnapshotState {
7676 this . unmatched = 0 ;
7777 this . _updateSnapshot = options . updateSnapshot ;
7878 this . updated = 0 ;
79-
80- this . _reinitializeData = ( ) => {
81- this . _snapshotData = data ;
82- this . _inlineSnapshots = [ ] ;
83- this . _counters = new Map ( ) ;
84- this . _index = 0 ;
85- this . added = 0 ;
86- this . matched = 0 ;
87- this . unmatched = 0 ;
88- this . updated = 0 ;
89- } ;
9079 }
9180
9281 markSnapshotsAsCheckedForTest ( testName : string ) {
@@ -122,7 +111,14 @@ export default class SnapshotState {
122111 }
123112
124113 clear ( ) {
125- this . _reinitializeData ( ) ;
114+ this . _snapshotData = this . _initialData ;
115+ this . _inlineSnapshots = [ ] ;
116+ this . _counters = new Map ( ) ;
117+ this . _index = 0 ;
118+ this . added = 0 ;
119+ this . matched = 0 ;
120+ this . unmatched = 0 ;
121+ this . updated = 0 ;
126122 }
127123
128124 save ( ) {
0 commit comments