@@ -458,14 +458,16 @@ class FlutterPlatform extends PlatformPlugin {
458458 controllerSinkClosed = true ;
459459 }));
460460
461- // When start paused is specified, it means that the user is likely
462- // running this with a debugger attached. Initialize the resident
463- // compiler in this case.
464- if (debuggingOptions.startPaused) {
465- compiler ?? = TestCompiler (debuggingOptions.buildInfo, flutterProject, precompiledDillPath: precompiledDillPath, testTimeRecorder: testTimeRecorder);
466- final Uri testUri = globals.fs.file (testPath).uri;
467- // Trigger a compilation to initialize the resident compiler.
468- unawaited (compiler! .compile (testUri));
461+ void initializeExpressionCompiler (String path) {
462+ // When start paused is specified, it means that the user is likely
463+ // running this with a debugger attached. Initialize the resident
464+ // compiler in this case.
465+ if (debuggingOptions.startPaused) {
466+ compiler ?? = TestCompiler (debuggingOptions.buildInfo, flutterProject, precompiledDillPath: precompiledDillPath, testTimeRecorder: testTimeRecorder);
467+ final Uri uri = globals.fs.file (path).uri;
468+ // Trigger a compilation to initialize the resident compiler.
469+ unawaited (compiler! .compile (uri));
470+ }
469471 }
470472
471473 // If a kernel file is given, then use that to launch the test.
@@ -474,6 +476,7 @@ class FlutterPlatform extends PlatformPlugin {
474476 String ? mainDart;
475477 if (precompiledDillPath != null ) {
476478 mainDart = precompiledDillPath;
479+ initializeExpressionCompiler (testPath);
477480 } else if (precompiledDillFiles != null ) {
478481 mainDart = precompiledDillFiles! [testPath];
479482 } else {
@@ -489,6 +492,9 @@ class FlutterPlatform extends PlatformPlugin {
489492 testHarnessChannel.sink.addError ('Compilation failed for testPath=$testPath ' );
490493 return null ;
491494 }
495+ } else {
496+ // For integration tests, we may still need to set up expression compilation service.
497+ initializeExpressionCompiler (mainDart);
492498 }
493499 }
494500
0 commit comments