mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
test: cover setGlobal/setProject catch blocks and session-start main().catch
- setup-package-manager: setGlobal catch when HOME is non-directory (ENOTDIR) - setup-package-manager: setProject catch when CWD is read-only (EACCES) - session-start: main().catch handler when ensureDir throws (exit 0, don't block) Total tests: 825 → 828
This commit is contained in:
@@ -3153,6 +3153,26 @@ async function runTests() {
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
// ── Round 74: session-start.js main().catch handler ──
|
||||
console.log('\nRound 74: session-start.js (main catch — unrecoverable error):');
|
||||
|
||||
if (await asyncTest('session-start exits 0 with error message when HOME is non-directory', async () => {
|
||||
if (process.platform === 'win32') {
|
||||
console.log(' (skipped — /dev/null not available on Windows)');
|
||||
return;
|
||||
}
|
||||
// HOME=/dev/null makes ensureDir(sessionsDir) throw ENOTDIR,
|
||||
// which propagates to main().catch — the top-level error boundary
|
||||
const result = await runScript(path.join(scriptsDir, 'session-start.js'), '', {
|
||||
HOME: '/dev/null',
|
||||
USERPROFILE: '/dev/null'
|
||||
});
|
||||
assert.strictEqual(result.code, 0,
|
||||
`Should exit 0 (don't block on errors), got ${result.code}`);
|
||||
assert.ok(result.stderr.includes('[SessionStart] Error:'),
|
||||
`stderr should contain [SessionStart] Error:, got: ${result.stderr}`);
|
||||
})) passed++; else failed++;
|
||||
|
||||
// Summary
|
||||
console.log('\n=== Test Results ===');
|
||||
console.log(`Passed: ${passed}`);
|
||||
|
||||
Reference in New Issue
Block a user