mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
test: cover evaluate-session/suggest-compact main().catch and validate-hooks JSON parse
- evaluate-session: main().catch when HOME is non-directory (ENOTDIR) - suggest-compact: main().catch double-failure when TMPDIR is non-directory - validate-hooks: invalid JSON in hooks.json triggers error exit Total tests: 831 → 834
This commit is contained in:
@@ -1991,6 +1991,22 @@ function runTests() {
|
||||
fs.rmSync(skillsDir, { recursive: true, force: true });
|
||||
})) passed++; else failed++;
|
||||
|
||||
// ── Round 76: validate-hooks.js invalid JSON in hooks.json ──
|
||||
console.log('\nRound 76: validate-hooks.js (invalid JSON in hooks.json):');
|
||||
|
||||
if (test('reports error for invalid JSON in hooks.json', () => {
|
||||
const testDir = createTestDir();
|
||||
const hooksFile = path.join(testDir, 'hooks.json');
|
||||
fs.writeFileSync(hooksFile, '{not valid json!!!');
|
||||
|
||||
const result = runValidatorWithDir('validate-hooks', 'HOOKS_FILE', hooksFile);
|
||||
assert.strictEqual(result.code, 1,
|
||||
`Expected exit 1 for invalid JSON, got ${result.code}`);
|
||||
assert.ok(result.stderr.includes('Invalid JSON'),
|
||||
`stderr should mention Invalid JSON, got: ${result.stderr}`);
|
||||
cleanupTestDir(testDir);
|
||||
})) passed++; else failed++;
|
||||
|
||||
// Summary
|
||||
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
|
||||
process.exit(failed > 0 ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user