fix: capture stderr in typecheck hook, add 13 tests for session-end and utils

- post-edit-typecheck.js: capture both stdout and stderr from tsc
- hooks.test.js: 7 extractSessionSummary tests (JSONL parsing, array content,
  malformed lines, empty transcript, long message truncation, env var fallback)
- utils.test.js: 6 tests (replaceInFile g-flag behavior, string replace,
  capture groups, writeFile overwrite, unicode content)

Total test count: 294 → 307
This commit is contained in:
Affaan Mustafa
2026-02-12 16:31:07 -08:00
parent e9f0f1334f
commit b1b28f2f92
3 changed files with 212 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ process.stdin.on('end', () => {
});
} catch (err) {
// tsc exits non-zero when there are errors — filter to edited file
const output = err.stdout || '';
const output = (err.stdout || '') + (err.stderr || '');
const relevantLines = output
.split('\n')
.filter(line => line.includes(filePath) || line.includes(path.basename(filePath)))