@@ -212,6 +212,9 @@ void main() {
212
212
await resume ();
213
213
}
214
214
215
+ Future <Event > waitForBreakpoint () =>
216
+ stream.firstWhere ((event) => event.kind == EventKind .kPauseBreakpoint);
217
+
215
218
test ('after edit and hot restart, breakpoint is in new file' , () async {
216
219
final oldLog = 'main gen0' ;
217
220
final newLog = 'main gen1' ;
@@ -220,14 +223,14 @@ void main() {
220
223
221
224
await makeEditAndRecompile (mainFile, oldLog, newLog);
222
225
226
+ final breakpointFuture = waitForBreakpoint ();
227
+
223
228
await hotRestartAndHandlePausePost ([
224
229
(file: mainFile, breakpointMarker: callLogMarker),
225
230
]);
226
231
227
232
// Should break at `callLog`.
228
- await stream.firstWhere (
229
- (event) => event.kind == EventKind .kPauseBreakpoint,
230
- );
233
+ await breakpointFuture;
231
234
expect (consoleLogs.contains (newLog), false );
232
235
await resumeAndExpectLog (newLog);
233
236
});
@@ -244,14 +247,14 @@ void main() {
244
247
final newString = "log('$extraLog ');\n $oldString " ;
245
248
await makeEditAndRecompile (mainFile, oldString, newString);
246
249
250
+ var breakpointFuture = waitForBreakpoint ();
251
+
247
252
await hotRestartAndHandlePausePost ([
248
253
(file: mainFile, breakpointMarker: callLogMarker),
249
254
]);
250
255
251
256
// Should break at `callLog`.
252
- await stream.firstWhere (
253
- (event) => event.kind == EventKind .kPauseBreakpoint,
254
- );
257
+ await breakpointFuture;
255
258
expect (consoleLogs.contains (extraLog), true );
256
259
expect (consoleLogs.contains (genLog), false );
257
260
await resumeAndExpectLog (genLog);
@@ -261,14 +264,14 @@ void main() {
261
264
// Remove the line we just added.
262
265
await makeEditAndRecompile (mainFile, newString, oldString);
263
266
267
+ breakpointFuture = waitForBreakpoint ();
268
+
264
269
await hotRestartAndHandlePausePost ([
265
270
(file: mainFile, breakpointMarker: callLogMarker),
266
271
]);
267
272
268
273
// Should break at `callLog`.
269
- await stream.firstWhere (
270
- (event) => event.kind == EventKind .kPauseBreakpoint,
271
- );
274
+ await breakpointFuture;
272
275
expect (consoleLogs.contains (extraLog), false );
273
276
expect (consoleLogs.contains (genLog), false );
274
277
await resumeAndExpectLog (genLog);
@@ -301,21 +304,22 @@ void main() {
301
304
final newLog = "log('\$ libraryValue');" ;
302
305
await makeEditAndRecompile (mainFile, oldLog, newLog);
303
306
307
+ var breakpointFuture = waitForBreakpoint ();
308
+
304
309
await hotRestartAndHandlePausePost ([
305
310
(file: mainFile, breakpointMarker: callLogMarker),
306
311
(file: libFile, breakpointMarker: libValueMarker),
307
312
]);
308
313
309
314
// Should break at `callLog`.
310
- await stream.firstWhere (
311
- (event) => event.kind == EventKind .kPauseBreakpoint,
312
- );
315
+ await breakpointFuture;
313
316
expect (consoleLogs.contains (libGenLog), false );
317
+
318
+ breakpointFuture = waitForBreakpoint ();
319
+
314
320
await resume ();
315
321
// Should break at `libValue`.
316
- await stream.firstWhere (
317
- (event) => event.kind == EventKind .kPauseBreakpoint,
318
- );
322
+ await breakpointFuture;
319
323
expect (consoleLogs.contains (libGenLog), false );
320
324
await resumeAndExpectLog (libGenLog);
321
325
0 commit comments