* 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)
| 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. |
no test coverage detected