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

Method findMatchingDynamicNode

src/shared/test/test_model.ts:584–596  ·  view source on GitHub ↗

* Find a matching node in 'parent' that might be a node for a dynamic test/group that name is * an instance of.

(parent: T, name: string)

Source from the content-addressed store, hash-verified

582 * an instance of.
583 */
584 private findMatchingDynamicNode<T extends GroupNode | SuiteNode>(parent: T, name: string): T | undefined {
585 // If the parent has any children exactly named us, they should be used regardless.
586 if (parent.children.find((c) => c.name === name))
587 return;
588
589 for (const child of parent.children) {
590 if (!child.name || typeof child !== typeof parent)
591 continue;
592 const regex = new RegExp(makeRegexForTests([{ name: child.name, isGroup: child instanceof GroupNode, position: undefined }]));
593 if (regex.test(name))
594 return child as any as T;
595 }
596 }
597
598 /**
599 * If this node is from a result, track its location so we can keep it up-to-date as the user edits the file.

Callers 2

groupDiscoveredMethod · 0.95
testDiscoveredMethod · 0.95

Calls 1

makeRegexForTestsFunction · 0.90

Tested by

no test coverage detected