Skip to content

Commit 6bdc195

Browse files
committed
Force noDebug mode if running Flutter tests for a whole folder
Fixes #2082.
1 parent a5d2f15 commit 6bdc195

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎src/extension/providers/debug_config_provider.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { config } from "../config";
2828
import { locateBestProjectRoot } from "../project";
2929
import { PubGlobal } from "../pub/global";
3030
import { WebDev } from "../pub/webdev";
31-
import { isDartFile, isFlutterProjectFolder, isFlutterWorkspaceFolder, isInsideFolderNamed, isTestFile, isTestFileOrFolder, projectShouldUsePubForTests as shouldUsePubForTests } from "../utils";
31+
import { isDartFile, isFlutterProjectFolder, isFlutterWorkspaceFolder, isInsideFolderNamed, isTestFile, isTestFileOrFolder, isTestFolder, projectShouldUsePubForTests as shouldUsePubForTests } from "../utils";
3232
import { getGlobalFlutterArgs, getToolEnv } from "../utils/processes";
3333
import { TestResultsProvider } from "../views/test_view";
3434

@@ -222,6 +222,14 @@ export class DebugConfigProvider implements DebugConfigurationProvider {
222222
return undefined; // undefined means silent (don't open launch.json).
223223
}
224224

225+
if (debugType === DebuggerType.FlutterTest && isTestFolder(debugConfig.program) && !debugConfig.noDebug) {
226+
// When running `flutter test (folder)`, multiple debug sessions are created - one for each file. This is
227+
// different to how `pub run test (folder)` works (one debug session, which each file in an isolate). The
228+
// debugger does not currently support multiple VM service sessions so we have to downgrade this to noDebug.
229+
logger.warn("Setting noDebug=true for Flutter test run because it's a folder");
230+
debugConfig.noDebug = true;
231+
}
232+
225233
// If we're attaching to Dart, ensure we get an observatory URI.
226234
if (isAttachRequest && !debugConfig.serviceInfoFile) {
227235
// For attaching, the Observatory address must be specified. If it's not provided already, prompt for it.

0 commit comments

Comments
 (0)