@@ -76,8 +76,13 @@ describe('Scheduler', () => {
76
76
// shouldYield = Scheduler.unstable_shouldYield;
77
77
} ) ;
78
78
79
+ const PRIORITY = 0 ;
80
+ const CURRENT_TASK_ID = 1 ;
81
+ const CURRENT_RUN_ID = 2 ;
82
+ const QUEUE_SIZE = 3 ;
83
+
79
84
afterEach ( ( ) => {
80
- if ( sharedProfilingArray [ 2 ] !== 0 ) {
85
+ if ( sharedProfilingArray [ QUEUE_SIZE ] !== 0 ) {
81
86
throw Error (
82
87
'Test exited, but the shared profiling buffer indicates that a task ' +
83
88
'is still running' ,
@@ -241,9 +246,6 @@ describe('Scheduler', () => {
241
246
return '\n' + result ;
242
247
}
243
248
244
- const PRIORITY = 0 ;
245
- const CURRENT_TASK_ID = 1 ;
246
- const QUEUE_SIZE = 2 ;
247
249
function getProfilingInfo ( ) {
248
250
const queueSize = sharedProfilingArray [ QUEUE_SIZE ] ;
249
251
if ( queueSize === 0 ) {
@@ -253,11 +255,12 @@ describe('Scheduler', () => {
253
255
if ( priorityLevel === 0 ) {
254
256
return 'Suspended, Queue Size: ' + queueSize ;
255
257
}
256
- return `Current Task: ${
257
- sharedProfilingArray [ QUEUE_SIZE ]
258
- } , Priority: ${ priorityLevelToString ( priorityLevel ) } , Queue Size: ${
259
- sharedProfilingArray [ CURRENT_TASK_ID ]
260
- } `;
258
+ return (
259
+ `Task: ${ sharedProfilingArray [ CURRENT_TASK_ID ] } , ` +
260
+ `Run: ${ sharedProfilingArray [ CURRENT_RUN_ID ] } , ` +
261
+ `Priority: ${ priorityLevelToString ( priorityLevel ) } , ` +
262
+ `Queue Size: ${ sharedProfilingArray [ QUEUE_SIZE ] } `
263
+ ) ;
261
264
}
262
265
263
266
it ( 'creates a basic flamegraph' , ( ) => {
@@ -287,13 +290,13 @@ describe('Scheduler', () => {
287
290
{ label : 'Foo' } ,
288
291
) ;
289
292
expect ( Scheduler ) . toFlushAndYieldThrough ( [
290
- 'Current Task: 1, Priority: Normal, Queue Size: 1' ,
293
+ 'Task: 1, Run : 1, Priority: Normal, Queue Size: 1' ,
291
294
'Yield' ,
292
295
] ) ;
293
296
Scheduler . unstable_advanceTime ( 100 ) ;
294
297
expect ( Scheduler ) . toFlushAndYield ( [
295
- 'Current Task: 2, Priority: User-blocking, Queue Size: 2' ,
296
- 'Current Task: 1, Priority: Normal, Queue Size: 1' ,
298
+ 'Task: 2, Run : 2, Priority: User-blocking, Queue Size: 2' ,
299
+ 'Task: 1, Run: 3 , Priority: Normal, Queue Size: 1' ,
297
300
] ) ;
298
301
299
302
expect ( getProfilingInfo ( ) ) . toEqual ( 'Empty Queue' ) ;
@@ -321,7 +324,7 @@ Task 1 [Normal] │ ████████░░░░░░░
321
324
} ) ;
322
325
323
326
expect ( Scheduler ) . toFlushAndYieldThrough ( [
324
- 'Current Task: 1, Priority: Normal, Queue Size: 1' ,
327
+ 'Task: 1, Run : 1, Priority: Normal, Queue Size: 1' ,
325
328
'Yield' ,
326
329
] ) ;
327
330
Scheduler . unstable_advanceTime ( 100 ) ;
0 commit comments