(src: string)
| 90 | |
| 91 | /** Best-effort: find the root React component name to mount (defaults to "App"). */ |
| 92 | export function detectReactComponent(src: string): string { |
| 93 | const m = |
| 94 | src.match(/function\s+([A-Z][A-Za-z0-9_]*)\s*\(/) || |
| 95 | src.match(/(?:const|let|var)\s+([A-Z][A-Za-z0-9_]*)\s*=\s*(?:\(|function|React\.memo|memo)/) || |
| 96 | src.match(/class\s+([A-Z][A-Za-z0-9_]*)\s+extends/); |
| 97 | return m ? m[1] : 'App'; |
| 98 | } |
| 99 | |
| 100 | function reactHarness(src: string): string { |
| 101 | const code = stripModuleSyntax(src); |
no outgoing calls
no test coverage detected