* Create a routing test working directory. * Uses the actual repo checkout (ROOT) which has CLAUDE.md, .claude/skills/, * and full project context. This matches the local environment where routing * tests pass reliably. In containerized CI, bare tmpDirs lack the context * Claude needs to make co
(suffix: string)
| 127 | * Claude needs to make correct routing decisions. |
| 128 | */ |
| 129 | function createRoutingWorkDir(suffix: string): string { |
| 130 | // Clone the repo checkout into a tmpDir so concurrent tests don't interfere |
| 131 | const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), `routing-${suffix}-`)); |
| 132 | // Copy essential context files |
| 133 | const filesToCopy = ['CLAUDE.md', 'README.md', 'package.json', 'ETHOS.md']; |
| 134 | for (const f of filesToCopy) { |
| 135 | const src = path.join(ROOT, f); |
| 136 | if (fs.existsSync(src)) fs.copyFileSync(src, path.join(tmpDir, f)); |
| 137 | } |
| 138 | // Copy skill files |
| 139 | installSkills(tmpDir); |
| 140 | // Init git |
| 141 | initGitRepo(tmpDir); |
| 142 | spawnSync('git', ['add', '.'], { cwd: tmpDir, stdio: 'pipe', timeout: 5000 }); |
| 143 | spawnSync('git', ['commit', '-m', 'initial'], { cwd: tmpDir, stdio: 'pipe', timeout: 5000 }); |
| 144 | return tmpDir; |
| 145 | } |
| 146 | |
| 147 | function logCost(label: string, result: { costEstimate: { turnsUsed: number; estimatedTokens: number; estimatedCost: number }; duration: number }) { |
| 148 | const { turnsUsed, estimatedTokens, estimatedCost } = result.costEstimate; |
no test coverage detected