(srcFile, importPath)
| 34 | |
| 35 | // Helper: resolve an import path from a source file to a stub file |
| 36 | function resolveImport(srcFile, importPath) { |
| 37 | // Handle src/ prefix imports |
| 38 | if (importPath.startsWith('src/')) { |
| 39 | const resolved = importPath.replace(/\.js$/, '.ts'); |
| 40 | if (stubFiles.has(resolved)) return resolved; |
| 41 | return null; |
| 42 | } |
| 43 | // Handle relative imports |
| 44 | if (importPath.startsWith('.')) { |
| 45 | const srcDir = dirname(srcFile); |
| 46 | const resolved = join(srcDir, importPath).replace(/\.js$/, '.ts'); |
| 47 | if (stubFiles.has(resolved)) return resolved; |
| 48 | // Try .tsx |
| 49 | const resolvedTsx = join(srcDir, importPath).replace(/\.js$/, '.tsx'); |
| 50 | if (stubFiles.has(resolvedTsx)) return resolvedTsx; |
| 51 | return null; |
| 52 | } |
| 53 | return null; |
| 54 | } |
| 55 | |
| 56 | for (const srcFile of allTsFiles) { |
| 57 | if (stubFiles.has(srcFile)) continue; // skip stub files themselves |
no test coverage detected