(launchArgs: DartVsCodeLaunchArgs & DebugProtocol.LaunchRequestArguments)
| 145 | } |
| 146 | |
| 147 | public async launch(launchArgs: DartVsCodeLaunchArgs & DebugProtocol.LaunchRequestArguments): Promise<void> { |
| 148 | const configuration = Object.assign( |
| 149 | { |
| 150 | name: "Dart & Flutter", |
| 151 | request: "launch", |
| 152 | type: "dart", |
| 153 | }, |
| 154 | launchArgs, |
| 155 | ); |
| 156 | const currentSession = this.currentSession = { |
| 157 | configuration, |
| 158 | customRequest: async (cmd, args) => (await this.customRequest(cmd, args)).body as unknown, |
| 159 | getDebugProtocolBreakpoint: () => { throw new Error("Not implemented for tests"); }, |
| 160 | id: `INTEGRATION-TEST-${getRandomInt(0x1000, 0x10000).toString(16)}`, |
| 161 | name: configuration.name, |
| 162 | type: configuration.type, |
| 163 | workspaceFolder: undefined, |
| 164 | }; |
| 165 | |
| 166 | // The new DAP doesn't default to breaking on any exceptions so to simplify tests |
| 167 | // set it based on whether we'd in debug mode or not. |
| 168 | const isDebugging = !(launchArgs.noDebug ?? false); |
| 169 | if (isDebugging) |
| 170 | await this.setExceptionBreakpointsRequest({ filters: ["Unhandled"] }); |
| 171 | |
| 172 | // Set up logging. |
| 173 | for (const trackerFactory of this.debugTrackerFactories) { |
| 174 | const tracker = await trackerFactory.createDebugAdapterTracker(currentSession); |
| 175 | if (tracker) { |
| 176 | this.currentTrackers.push(tracker); |
| 177 | if (tracker.onWillStartSession) |
| 178 | tracker.onWillStartSession(); |
| 179 | } |
| 180 | } |
| 181 | this.on("terminated", () => { |
| 182 | for (const tracker of this.currentTrackers) { |
| 183 | if (tracker.onWillStopSession) |
| 184 | tracker.onWillStopSession(); |
| 185 | } |
| 186 | }); |
| 187 | |
| 188 | this.debugCommands.handleDebugSessionStart(currentSession); |
| 189 | this.waitForEvent("terminated", "for handleDebugSessionEnd", tenMinutesInMs) |
| 190 | .then(() => { |
| 191 | this.debugCommands.handleDebugSessionEnd(currentSession); |
| 192 | privateApi.testController?.handleDebugSessionEnd(currentSession); |
| 193 | }) |
| 194 | .catch((e) => console.error(`Error while waiting for termination: ${e}`)); |
| 195 | |
| 196 | // We override the base method to swap for attachRequest when required, so that |
| 197 | // all the existing methods that provide useful functionality but assume launching |
| 198 | // (for ex. hitBreakpoint) can be used in attach tests. |
| 199 | const response = await watchPromise("launch->initializeRequest", this.initializeRequest()); |
| 200 | if (response.body?.supportsConfigurationDoneRequest) { |
| 201 | this._supportsConfigurationDoneRequest = true; |
| 202 | } |
| 203 | // Attach will be paused by default and issue a step when we connect; but our tests |
| 204 | // generally assume we will automatically resume. |
nothing calls this directly
no test coverage detected