@@ -235,6 +235,9 @@ void main() {
235
235
});
236
236
}
237
237
238
+ Future <Event > waitForBreakpoint () =>
239
+ stream.firstWhere ((event) => event.kind == EventKind .kPauseBreakpoint);
240
+
238
241
test ('after edit and hot reload, breakpoint is in new file' , () async {
239
242
final oldString = 'main gen0' ;
240
243
final newString = 'main gen1' ;
@@ -244,12 +247,12 @@ void main() {
244
247
breakpointMarker: callLogMarker,
245
248
);
246
249
250
+ var breakpointFuture = waitForBreakpoint ();
251
+
247
252
await callEvaluate ();
248
253
249
254
// Should break at `callLog`.
250
- await stream.firstWhere (
251
- (event) => event.kind == EventKind .kPauseBreakpoint,
252
- );
255
+ await breakpointFuture;
253
256
expect (consoleLogs.contains (oldString), false );
254
257
await resumeAndExpectLog (oldString);
255
258
@@ -262,12 +265,12 @@ void main() {
262
265
(file: mainFile, breakpointMarker: callLogMarker, bp: bp),
263
266
]);
264
267
268
+ breakpointFuture = waitForBreakpoint ();
269
+
265
270
await callEvaluate ();
266
271
267
272
// Should break at `callLog`.
268
- await stream.firstWhere (
269
- (event) => event.kind == EventKind .kPauseBreakpoint,
270
- );
273
+ await breakpointFuture;
271
274
expect (consoleLogs.contains (newString), false );
272
275
await resumeAndExpectLog (newString);
273
276
});
@@ -281,12 +284,12 @@ void main() {
281
284
breakpointMarker: callLogMarker,
282
285
);
283
286
287
+ var breakpointFuture = waitForBreakpoint ();
288
+
284
289
await callEvaluate ();
285
290
286
291
// Should break at `callLog`.
287
- await stream.firstWhere (
288
- (event) => event.kind == EventKind .kPauseBreakpoint,
289
- );
292
+ await breakpointFuture;
290
293
expect (consoleLogs.contains (genLog), false );
291
294
await resumeAndExpectLog (genLog);
292
295
@@ -303,12 +306,12 @@ void main() {
303
306
(file: mainFile, breakpointMarker: callLogMarker, bp: bp),
304
307
])).first;
305
308
309
+ breakpointFuture = waitForBreakpoint ();
310
+
306
311
await callEvaluate ();
307
312
308
313
// Should break at `callLog`.
309
- await stream.firstWhere (
310
- (event) => event.kind == EventKind .kPauseBreakpoint,
311
- );
314
+ await breakpointFuture;
312
315
expect (consoleLogs.contains (extraLog), true );
313
316
await resumeAndExpectLog (genLog);
314
317
@@ -321,12 +324,12 @@ void main() {
321
324
(file: mainFile, breakpointMarker: callLogMarker, bp: bp),
322
325
]);
323
326
327
+ breakpointFuture = waitForBreakpoint ();
328
+
324
329
await callEvaluate ();
325
330
326
331
// Should break at `callLog`.
327
- await stream.firstWhere (
328
- (event) => event.kind == EventKind .kPauseBreakpoint,
329
- );
332
+ await breakpointFuture;
330
333
expect (consoleLogs.contains (extraLog), false );
331
334
await resumeAndExpectLog (genLog);
332
335
});
@@ -342,12 +345,12 @@ void main() {
342
345
breakpointMarker: callLogMarker,
343
346
);
344
347
348
+ var breakpointFuture = waitForBreakpoint ();
349
+
345
350
await callEvaluate ();
346
351
347
352
// Should break at `callLog`.
348
- await stream.firstWhere (
349
- (event) => event.kind == EventKind .kPauseBreakpoint,
350
- );
353
+ await breakpointFuture;
351
354
expect (consoleLogs.contains (genLog), false );
352
355
await resumeAndExpectLog (genLog);
353
356
@@ -377,18 +380,19 @@ void main() {
377
380
(file: libFile, breakpointMarker: libValueMarker, bp: null ),
378
381
]);
379
382
383
+ breakpointFuture = waitForBreakpoint ();
384
+
380
385
await callEvaluate ();
381
386
382
387
// Should break at `callLog`.
383
- await stream.firstWhere (
384
- (event) => event.kind == EventKind .kPauseBreakpoint,
385
- );
388
+ await breakpointFuture;
386
389
expect (consoleLogs.contains (libGenLog), false );
390
+
391
+ breakpointFuture = waitForBreakpoint ();
392
+
387
393
await resume ();
388
394
// Should break at `libValue`.
389
- await stream.firstWhere (
390
- (event) => event.kind == EventKind .kPauseBreakpoint,
391
- );
395
+ await breakpointFuture;
392
396
expect (consoleLogs.contains (libGenLog), false );
393
397
await resumeAndExpectLog (libGenLog);
394
398
@@ -411,12 +415,12 @@ void main() {
411
415
(file: mainFile, breakpointMarker: capturedStringMarker, bp: bp),
412
416
])).first;
413
417
418
+ final breakpointFuture = waitForBreakpoint ();
419
+
414
420
await callEvaluate ();
415
421
416
422
// Should break at `capturedString`.
417
- await stream.firstWhere (
418
- (event) => event.kind == EventKind .kPauseBreakpoint,
419
- );
423
+ await breakpointFuture;
420
424
final oldCapturedString = 'captured closure gen0' ;
421
425
expect (consoleLogs.contains (oldCapturedString), false );
422
426
// Closure gets evaluated for the first time.
0 commit comments