Skip to content

Commit

Permalink
Add some delays
Browse files Browse the repository at this point in the history
Resolves some tests which were sensitive to particular async event
counts in ways that should not impact the production code.

Only a microtask is required, so these could be `await null`. Use
`pumpEventQueue()` anyway so the intent is clear.
  • Loading branch information
natebosch committed Jun 11, 2024
1 parent 742a99e commit d687c52
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build_runner/test/server/serve_handler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ void main() {
await createMockConnection(serverChannel1, 'web');
await createMockConnection(serverChannel2, 'web');
await handler.emitUpdateMessage(BuildResult(BuildStatus.success, []));
await pumpEventQueue();
await clientChannel1.sink.close();
await clientChannel2.sink.close();
});
Expand All @@ -337,8 +338,10 @@ void main() {
await createMockConnection(serverChannel1, 'web');
await createMockConnection(serverChannel2, 'web');
await handler.emitUpdateMessage(BuildResult(BuildStatus.success, []));
await pumpEventQueue();
await clientChannel2.sink.close();
await handler.emitUpdateMessage(BuildResult(BuildStatus.success, []));
await pumpEventQueue();
await clientChannel1.sink.close();
});

Expand Down Expand Up @@ -382,6 +385,7 @@ void main() {
AssetId('a', 'web/index.html'),
AssetId('a', 'lib/some.dart.js'),
]));
await pumpEventQueue();
await clientChannel1.sink.close();
});

Expand Down Expand Up @@ -421,6 +425,7 @@ void main() {
AssetId('a', 'web2/index.html'),
AssetId('a', 'lib/some.dart.js'),
]));
await pumpEventQueue();
await clientChannel1.sink.close();
await clientChannel2.sink.close();
});
Expand Down

0 comments on commit d687c52

Please sign in to comment.