MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / attachDebugger

Function attachDebugger

src/test/flutter_debug/flutter_run_attach.test.ts:30–55  ·  view source on GitHub ↗
(vmServiceUri?: string)

Source from the content-addressed store, hash-verified

28 });
29
30 async function attachDebugger(vmServiceUri?: string): Promise<vs.DebugConfiguration & DartVsCodeLaunchArgs> {
31 const config = await getAttachConfiguration({
32 args: [
33 // Disable DDS when connecting, because we launch processes with `flutter run` which
34 // connects a VM Service client, which will prevent DDS from connecting. This should not
35 // be required if the app was started as a native app (as would usually be the case, outside
36 // of tests).
37 "--disable-dds",
38 // Use pid-file as a convenient way of getting the test name into the command line args
39 // for easier debugging of processes that hang around on CI (we dump the process command
40 // line at the end of the test run).
41 "--pid-file", path.join(os.tmpdir(), fileSafeCurrentTestName),
42 ],
43 deviceId: flutterTestDeviceId,
44 vmServiceUri,
45 });
46 if (!config)
47 throw new Error(`Could not get attach configuration (got ${config})`);
48 await dc.start();
49 // Make sure any stdErr is logged to console + log file for debugging.
50 dc.on("output", (event: DebugProtocol.OutputEvent) => {
51 if (event.body.category === "stderr")
52 logger.error(event.body.output);
53 });
54 return config;
55 }
56
57 it("attaches to a Flutter application, collects stdout, remains active, detaches without stopping it", async () => {
58 const process = await spawnFlutterProcess(flutterHelloWorldMainFile);

Callers 1

Calls 4

getAttachConfigurationFunction · 0.90
onMethod · 0.80
errorMethod · 0.65
startMethod · 0.45

Tested by

no test coverage detected