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

Method assertOutputContains

src/test/dart_debug_client.ts:290–310  ·  view source on GitHub ↗
(category: string | undefined, text: string)

Source from the content-addressed store, hash-verified

288 }
289
290 public assertOutputContains(category: string | undefined, text: string): Promise<DebugProtocol.OutputEvent> {
291 let output = "";
292 let cleanup = () => { };
293 const textLF = text.replace(/\r/g, "");
294 const textCRLF = textLF.replace(/\n/g, "\r\n");
295 return withTimeout(
296 new Promise<DebugProtocol.OutputEvent>((resolve) => {
297 function handleOutput(event: DebugProtocol.OutputEvent) {
298 if (!category || (event.body.category ?? "console") === category) {
299 output += event.body.output;
300 if (output.includes(textLF) || output.includes(textCRLF)) {
301 resolve(event);
302 }
303 }
304 }
305 cleanup = () => this.removeListener("output", handleOutput);
306 this.on("output", handleOutput);
307 }),
308 () => `Didn't find text "${text}" in ${category}\nGot: ${output}`,
309 ).finally(() => cleanup());
310 }
311
312 public async debuggerReady(): Promise<void> {
313 await this.waitForCustomEvent("dart.debuggerUris");

Calls 2

withTimeoutFunction · 0.90
onMethod · 0.80

Tested by 2

testBreakpointConditionFunction · 0.64
testBreakpointConditionFunction · 0.64