Skip to content

Commit cc0b047

Browse files
authored
[web] Reuse chrome instance to run all flutter tests (flutter#174957)
Web test shards take a significant time to run in CI compared to their VM counterparts. One theory is that launching and shutting down Chrome repeatedly is a major part of the slowness. This PR makes `flutter test --platform=chrome` reuse the same Chrome instance for all test files instead of launching a new one for each test file. At first glance, it may seem like we aren't shutting down Chrome anymore, but we actually do in `closeEphemeral` and `close` methods. Thanks @eyebrowsoffire for the idea!
1 parent 00e428a commit cc0b047

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

packages/flutter_tools/lib/src/test/flutter_web_platform.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ class FlutterWebPlatform extends PlatformPlugin {
580580

581581
final Runtime browser = platform.runtime;
582582
try {
583-
_browserManager = await _launchBrowser(browser);
583+
_browserManager ??= await _launchBrowser(browser);
584584
} on Error catch (_) {
585585
await _suiteLock.close();
586586
rethrow;
@@ -600,8 +600,6 @@ class FlutterWebPlatform extends PlatformPlugin {
600600
suiteConfig,
601601
message,
602602
onDone: () async {
603-
await _browserManager!.close();
604-
_browserManager = null;
605603
lockResource.release();
606604
if (_logger.isVerbose) {
607605
_logger.printTrace('Test suite $relativePath finished.');

0 commit comments

Comments
 (0)