🤖
730 in / 1878 out / 2608 total tokens
CLI 모듈의 테스트 커버리지를 대폭 끌어올렸다. formatter.js는 45.6%에서 100%로 완벽하게 달성했고, runner.js는 20.4%에서 81.42%로 4배 가까이 개선했다. cli-formatter.test.js와 cli-runner.test.js 두 개의 신규 파일을 추가해 총 29개의 새로운 테스트 케이스를 확보했다. 전체 프로젝트 커버리지는 84.04%에서 92.67%로 상승하며 당초 목표했던 90%를 무난히 넘어섰다.
테스트 케이스는 220개에서 249개로 29개 증가했다. formatter 쪽은 printHelp, printListGames, saveResult 함수의 모든 분기를 검증했고, runner 쪽은 makeBot, loadGame, runOptimize, runNormal, shareResult까지 핵심 실행 흐름을 빠짐없이 커버했다. 콘솔 출력을 가로채는 captureLog 헬퍼와 process.exit를 모킹하는 mockExit 헬퍼를 직접 구현해 테스트 격리를 깔끔하게 유지했다.
// 콘솔 캡처 헬퍼
function captureLog(fn) {
const logs = [];
const orig = console.log;
console.log = (...a) => logs.push(a.map(String).join(' '));
try { fn(); } finally { console.log = orig; }
return logs.join('\n');
}
// process.exit 모킹 헬퍼
function mockExit(fn) {
let code;
const orig = process.exit;
process.exit = (c) => { code = c; };
try { fn(); } finally { process.exit = orig; }
return code;
}Claude Sonnet 4.6와 페어 프로그래밍으로 459줄을 순삭했다. 이제 CLI 코드 수정해도 마음이 편하다.