@@ -21,24 +21,28 @@ let NormalPriority;
21
21
22
22
describe ( 'SchedulerPostTaskOnly' , ( ) => {
23
23
beforeEach ( ( ) => {
24
- jest . resetModules ( ) ;
25
-
26
- // Un-mock scheduler
27
- jest . mock ( 'scheduler' , ( ) =>
28
- require . requireActual ( 'scheduler/unstable_post_task_only' ) ,
29
- ) ;
30
-
31
- runtime = installMockBrowserRuntime ( ) ;
32
- performance = window . performance ;
33
- Scheduler = require ( 'scheduler' ) ;
34
- cancelCallback = Scheduler . unstable_cancelCallback ;
35
- scheduleCallback = Scheduler . unstable_scheduleCallback ;
36
- NormalPriority = Scheduler . unstable_NormalPriority ;
24
+ if ( ! process . env . IS_BUILD ) {
25
+ jest . resetModules ( ) ;
26
+
27
+ // Un-mock scheduler
28
+ jest . mock ( 'scheduler' , ( ) =>
29
+ require . requireActual ( 'scheduler/unstable_post_task_only' ) ,
30
+ ) ;
31
+
32
+ runtime = installMockBrowserRuntime ( ) ;
33
+ performance = window . performance ;
34
+ Scheduler = require ( 'scheduler' ) ;
35
+ cancelCallback = Scheduler . unstable_cancelCallback ;
36
+ scheduleCallback = Scheduler . unstable_scheduleCallback ;
37
+ NormalPriority = Scheduler . unstable_NormalPriority ;
38
+ }
37
39
} ) ;
38
40
39
41
afterEach ( ( ) => {
40
- if ( ! runtime . isLogEmpty ( ) ) {
41
- throw Error ( 'Test exited without clearing log.' ) ;
42
+ if ( ! process . env . IS_BUILD ) {
43
+ if ( ! runtime . isLogEmpty ( ) ) {
44
+ throw Error ( 'Test exited without clearing log.' ) ;
45
+ }
42
46
}
43
47
} ) ;
44
48
@@ -138,6 +142,7 @@ describe('SchedulerPostTaskOnly', () => {
138
142
} ;
139
143
}
140
144
145
+ // @gate source
141
146
it ( 'task that finishes before deadline' , ( ) => {
142
147
scheduleCallback ( NormalPriority , ( ) => {
143
148
runtime . log ( 'Task' ) ;
@@ -147,6 +152,7 @@ describe('SchedulerPostTaskOnly', () => {
147
152
runtime . assertLog ( [ 'Task Event' , 'Task' ] ) ;
148
153
} ) ;
149
154
155
+ // @gate source
150
156
it ( 'task with continuation' , ( ) => {
151
157
scheduleCallback ( NormalPriority , ( ) => {
152
158
runtime . log ( 'Task' ) ;
@@ -167,6 +173,7 @@ describe('SchedulerPostTaskOnly', () => {
167
173
runtime . assertLog ( [ 'Task Event' , 'Continuation' ] ) ;
168
174
} ) ;
169
175
176
+ // @gate source
170
177
it ( 'multiple tasks' , ( ) => {
171
178
scheduleCallback ( NormalPriority , ( ) => {
172
179
runtime . log ( 'A' ) ;
@@ -179,6 +186,7 @@ describe('SchedulerPostTaskOnly', () => {
179
186
runtime . assertLog ( [ 'Task Event' , 'A' , 'B' ] ) ;
180
187
} ) ;
181
188
189
+ // @gate source
182
190
it ( 'multiple tasks with a yield in between' , ( ) => {
183
191
scheduleCallback ( NormalPriority , ( ) => {
184
192
runtime . log ( 'A' ) ;
@@ -199,6 +207,7 @@ describe('SchedulerPostTaskOnly', () => {
199
207
runtime . assertLog ( [ 'Task Event' , 'B' ] ) ;
200
208
} ) ;
201
209
210
+ // @gate source
202
211
it ( 'cancels tasks' , ( ) => {
203
212
const task = scheduleCallback ( NormalPriority , ( ) => {
204
213
runtime . log ( 'Task' ) ;
@@ -208,6 +217,7 @@ describe('SchedulerPostTaskOnly', () => {
208
217
runtime . assertLog ( [ ] ) ;
209
218
} ) ;
210
219
220
+ // @gate source
211
221
it ( 'throws when a task errors then continues in a new event' , ( ) => {
212
222
scheduleCallback ( NormalPriority , ( ) => {
213
223
runtime . log ( 'Oops!' ) ;
@@ -225,6 +235,7 @@ describe('SchedulerPostTaskOnly', () => {
225
235
runtime . assertLog ( [ 'Task Event' , 'Yay' ] ) ;
226
236
} ) ;
227
237
238
+ // @gate source
228
239
it ( 'schedule new task after queue has emptied' , ( ) => {
229
240
scheduleCallback ( NormalPriority , ( ) => {
230
241
runtime . log ( 'A' ) ;
@@ -242,6 +253,7 @@ describe('SchedulerPostTaskOnly', () => {
242
253
runtime . assertLog ( [ 'Task Event' , 'B' ] ) ;
243
254
} ) ;
244
255
256
+ // @gate source
245
257
it ( 'schedule new task after a cancellation' , ( ) => {
246
258
const handle = scheduleCallback ( NormalPriority , ( ) => {
247
259
runtime . log ( 'A' ) ;
0 commit comments