@@ -34,7 +34,7 @@ describe('YellowBoxRegistry', () => {
34
34
} ) ;
35
35
36
36
it ( 'adds and deletes warnings' , ( ) => {
37
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
37
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
38
38
const { category : categoryA } = YellowBoxCategory . parse ( [ 'A' ] ) ;
39
39
40
40
expect ( registry ( ) . size ) . toBe ( 1 ) ;
@@ -46,9 +46,9 @@ describe('YellowBoxRegistry', () => {
46
46
} ) ;
47
47
48
48
it ( 'clears all warnings' , ( ) => {
49
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
50
- YellowBoxRegistry . add ( { args : [ 'B' ] , framesToPop : 0 } ) ;
51
- YellowBoxRegistry . add ( { args : [ 'C' ] , framesToPop : 0 } ) ;
49
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
50
+ YellowBoxRegistry . add ( { args : [ 'B' ] } ) ;
51
+ YellowBoxRegistry . add ( { args : [ 'C' ] } ) ;
52
52
53
53
expect ( registry ( ) . size ) . toBe ( 3 ) ;
54
54
@@ -57,9 +57,9 @@ describe('YellowBoxRegistry', () => {
57
57
} ) ;
58
58
59
59
it ( 'sorts warnings in chronological order' , ( ) => {
60
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
61
- YellowBoxRegistry . add ( { args : [ 'B' ] , framesToPop : 0 } ) ;
62
- YellowBoxRegistry . add ( { args : [ 'C' ] , framesToPop : 0 } ) ;
60
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
61
+ YellowBoxRegistry . add ( { args : [ 'B' ] } ) ;
62
+ YellowBoxRegistry . add ( { args : [ 'C' ] } ) ;
63
63
64
64
const { category : categoryA } = YellowBoxCategory . parse ( [ 'A' ] ) ;
65
65
const { category : categoryB } = YellowBoxCategory . parse ( [ 'B' ] ) ;
@@ -71,7 +71,7 @@ describe('YellowBoxRegistry', () => {
71
71
categoryC ,
72
72
] ) ;
73
73
74
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
74
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
75
75
76
76
// Expect `A` to be hoisted to the end of the registry.
77
77
expect ( Array . from ( registry ( ) . keys ( ) ) ) . toEqual ( [
@@ -82,9 +82,9 @@ describe('YellowBoxRegistry', () => {
82
82
} ) ;
83
83
84
84
it ( 'ignores warnings matching patterns' , ( ) => {
85
- YellowBoxRegistry . add ( { args : [ 'A!' ] , framesToPop : 0 } ) ;
86
- YellowBoxRegistry . add ( { args : [ 'B?' ] , framesToPop : 0 } ) ;
87
- YellowBoxRegistry . add ( { args : [ 'C!' ] , framesToPop : 0 } ) ;
85
+ YellowBoxRegistry . add ( { args : [ 'A!' ] } ) ;
86
+ YellowBoxRegistry . add ( { args : [ 'B?' ] } ) ;
87
+ YellowBoxRegistry . add ( { args : [ 'C!' ] } ) ;
88
88
expect ( registry ( ) . size ) . toBe ( 3 ) ;
89
89
90
90
YellowBoxRegistry . addIgnorePatterns ( [ '!' ] ) ;
@@ -95,9 +95,9 @@ describe('YellowBoxRegistry', () => {
95
95
} ) ;
96
96
97
97
it ( 'ignores warnings matching regexs or pattern' , ( ) => {
98
- YellowBoxRegistry . add ( { args : [ 'There are 4 dogs' ] , framesToPop : 0 } ) ;
99
- YellowBoxRegistry . add ( { args : [ 'There are 3 cats' ] , framesToPop : 0 } ) ;
100
- YellowBoxRegistry . add ( { args : [ 'There are H cats' ] , framesToPop : 0 } ) ;
98
+ YellowBoxRegistry . add ( { args : [ 'There are 4 dogs' ] } ) ;
99
+ YellowBoxRegistry . add ( { args : [ 'There are 3 cats' ] } ) ;
100
+ YellowBoxRegistry . add ( { args : [ 'There are H cats' ] } ) ;
101
101
expect ( registry ( ) . size ) . toBe ( 3 ) ;
102
102
103
103
YellowBoxRegistry . addIgnorePatterns ( [ 'dogs' ] ) ;
@@ -111,9 +111,9 @@ describe('YellowBoxRegistry', () => {
111
111
} ) ;
112
112
113
113
it ( 'ignores all warnings when disabled' , ( ) => {
114
- YellowBoxRegistry . add ( { args : [ 'A!' ] , framesToPop : 0 } ) ;
115
- YellowBoxRegistry . add ( { args : [ 'B?' ] , framesToPop : 0 } ) ;
116
- YellowBoxRegistry . add ( { args : [ 'C!' ] , framesToPop : 0 } ) ;
114
+ YellowBoxRegistry . add ( { args : [ 'A!' ] } ) ;
115
+ YellowBoxRegistry . add ( { args : [ 'B?' ] } ) ;
116
+ YellowBoxRegistry . add ( { args : [ 'C!' ] } ) ;
117
117
expect ( registry ( ) . size ) . toBe ( 3 ) ;
118
118
119
119
YellowBoxRegistry . setDisabled ( true ) ;
@@ -124,57 +124,57 @@ describe('YellowBoxRegistry', () => {
124
124
} ) ;
125
125
126
126
it ( 'groups warnings by simple categories' , ( ) => {
127
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
127
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
128
128
expect ( registry ( ) . size ) . toBe ( 1 ) ;
129
129
130
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
130
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
131
131
expect ( registry ( ) . size ) . toBe ( 1 ) ;
132
132
133
- YellowBoxRegistry . add ( { args : [ 'B' ] , framesToPop : 0 } ) ;
133
+ YellowBoxRegistry . add ( { args : [ 'B' ] } ) ;
134
134
expect ( registry ( ) . size ) . toBe ( 2 ) ;
135
135
} ) ;
136
136
137
137
it ( 'groups warnings by format string categories' , ( ) => {
138
- YellowBoxRegistry . add ( { args : [ '%s' , 'A' ] , framesToPop : 0 } ) ;
138
+ YellowBoxRegistry . add ( { args : [ '%s' , 'A' ] } ) ;
139
139
expect ( registry ( ) . size ) . toBe ( 1 ) ;
140
140
141
- YellowBoxRegistry . add ( { args : [ '%s' , 'B' ] , framesToPop : 0 } ) ;
141
+ YellowBoxRegistry . add ( { args : [ '%s' , 'B' ] } ) ;
142
142
expect ( registry ( ) . size ) . toBe ( 1 ) ;
143
143
144
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
144
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
145
145
expect ( registry ( ) . size ) . toBe ( 2 ) ;
146
146
147
- YellowBoxRegistry . add ( { args : [ 'B' ] , framesToPop : 0 } ) ;
147
+ YellowBoxRegistry . add ( { args : [ 'B' ] } ) ;
148
148
expect ( registry ( ) . size ) . toBe ( 3 ) ;
149
149
} ) ;
150
150
151
151
it ( 'groups warnings with consideration for arguments' , ( ) => {
152
- YellowBoxRegistry . add ( { args : [ 'A' , 'B' ] , framesToPop : 0 } ) ;
152
+ YellowBoxRegistry . add ( { args : [ 'A' , 'B' ] } ) ;
153
153
expect ( registry ( ) . size ) . toBe ( 1 ) ;
154
154
155
- YellowBoxRegistry . add ( { args : [ 'A' , 'B' ] , framesToPop : 0 } ) ;
155
+ YellowBoxRegistry . add ( { args : [ 'A' , 'B' ] } ) ;
156
156
expect ( registry ( ) . size ) . toBe ( 1 ) ;
157
157
158
- YellowBoxRegistry . add ( { args : [ 'A' , 'C' ] , framesToPop : 0 } ) ;
158
+ YellowBoxRegistry . add ( { args : [ 'A' , 'C' ] } ) ;
159
159
expect ( registry ( ) . size ) . toBe ( 2 ) ;
160
160
161
- YellowBoxRegistry . add ( { args : [ '%s' , 'A' , 'A' ] , framesToPop : 0 } ) ;
161
+ YellowBoxRegistry . add ( { args : [ '%s' , 'A' , 'A' ] } ) ;
162
162
expect ( registry ( ) . size ) . toBe ( 3 ) ;
163
163
164
- YellowBoxRegistry . add ( { args : [ '%s' , 'B' , 'A' ] , framesToPop : 0 } ) ;
164
+ YellowBoxRegistry . add ( { args : [ '%s' , 'B' , 'A' ] } ) ;
165
165
expect ( registry ( ) . size ) . toBe ( 3 ) ;
166
166
167
- YellowBoxRegistry . add ( { args : [ '%s' , 'B' , 'B' ] , framesToPop : 0 } ) ;
167
+ YellowBoxRegistry . add ( { args : [ '%s' , 'B' , 'B' ] } ) ;
168
168
expect ( registry ( ) . size ) . toBe ( 4 ) ;
169
169
} ) ;
170
170
171
171
it ( 'ignores warnings starting with "(ADVICE)"' , ( ) => {
172
- YellowBoxRegistry . add ( { args : [ '(ADVICE) ...' ] , framesToPop : 0 } ) ;
172
+ YellowBoxRegistry . add ( { args : [ '(ADVICE) ...' ] } ) ;
173
173
expect ( registry ( ) . size ) . toBe ( 0 ) ;
174
174
} ) ;
175
175
176
176
it ( 'does not ignore warnings formatted to start with "(ADVICE)"' , ( ) => {
177
- YellowBoxRegistry . add ( { args : [ '%s ...' , '(ADVICE)' ] , framesToPop : 0 } ) ;
177
+ YellowBoxRegistry . add ( { args : [ '%s ...' , '(ADVICE)' ] } ) ;
178
178
expect ( registry ( ) . size ) . toBe ( 1 ) ;
179
179
} ) ;
180
180
@@ -189,8 +189,8 @@ describe('YellowBoxRegistry', () => {
189
189
const { observer} = observe ( ) ;
190
190
expect ( observer . mock . calls . length ) . toBe ( 1 ) ;
191
191
192
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
193
- YellowBoxRegistry . add ( { args : [ 'B' ] , framesToPop : 0 } ) ;
192
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
193
+ YellowBoxRegistry . add ( { args : [ 'B' ] } ) ;
194
194
jest . runAllImmediates ( ) ;
195
195
expect ( observer . mock . calls . length ) . toBe ( 2 ) ;
196
196
} ) ;
@@ -207,7 +207,7 @@ describe('YellowBoxRegistry', () => {
207
207
const { observer} = observe ( ) ;
208
208
expect ( observer . mock . calls . length ) . toBe ( 1 ) ;
209
209
210
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
210
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
211
211
jest . runAllImmediates ( ) ;
212
212
expect ( observer . mock . calls . length ) . toBe ( 2 ) ;
213
213
@@ -226,7 +226,7 @@ describe('YellowBoxRegistry', () => {
226
226
const { observer} = observe ( ) ;
227
227
expect ( observer . mock . calls . length ) . toBe ( 1 ) ;
228
228
229
- YellowBoxRegistry . add ( { args : [ 'A' ] , framesToPop : 0 } ) ;
229
+ YellowBoxRegistry . add ( { args : [ 'A' ] } ) ;
230
230
jest . runAllImmediates ( ) ;
231
231
expect ( observer . mock . calls . length ) . toBe ( 2 ) ;
232
232
0 commit comments