Skip to content

Commit 8fc49ba

Browse files
authored
Merge pull request anomalyco#11 from pangerlkr/copilot/fix-ci-test-failures
Fix session-manager tests failing in CI due to missing test isolation
2 parents 3ad211b + b90448a commit 8fc49ba

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎tests/lib/session-manager.test.js‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,27 @@ src/main.ts
14881488
'Content without session items should have 0 totalItems');
14891489
})) passed++; else failed++;
14901490

1491+
// Re-establish test environment for Rounds 95-98 (these tests need sessions to exist)
1492+
const tmpHome2 = path.join(os.tmpdir(), `ecc-session-mgr-test-2-${Date.now()}`);
1493+
const tmpSessionsDir2 = path.join(tmpHome2, '.claude', 'sessions');
1494+
fs.mkdirSync(tmpSessionsDir2, { recursive: true });
1495+
const origHome2 = process.env.HOME;
1496+
const origUserProfile2 = process.env.USERPROFILE;
1497+
1498+
// Create test session files for these tests
1499+
const testSessions2 = [
1500+
{ name: '2026-01-15-aaaa1111-session.tmp', content: '# Test Session 1' },
1501+
{ name: '2026-02-01-bbbb2222-session.tmp', content: '# Test Session 2' },
1502+
{ name: '2026-02-10-cccc3333-session.tmp', content: '# Test Session 3' },
1503+
];
1504+
for (const session of testSessions2) {
1505+
const filePath = path.join(tmpSessionsDir2, session.name);
1506+
fs.writeFileSync(filePath, session.content);
1507+
}
1508+
1509+
process.env.HOME = tmpHome2;
1510+
process.env.USERPROFILE = tmpHome2;
1511+
14911512
// ── Round 95: getAllSessions with both negative offset AND negative limit ──
14921513
console.log('\nRound 95: getAllSessions (both negative offset and negative limit):');
14931514

@@ -1579,6 +1600,20 @@ src/main.ts
15791600
);
15801601
})) passed++; else failed++;
15811602

1603+
// Cleanup test environment for Rounds 95-98 that needed sessions
1604+
// (Round 98: parseSessionFilename below doesn't need sessions)
1605+
process.env.HOME = origHome2;
1606+
if (origUserProfile2 !== undefined) {
1607+
process.env.USERPROFILE = origUserProfile2;
1608+
} else {
1609+
delete process.env.USERPROFILE;
1610+
}
1611+
try {
1612+
fs.rmSync(tmpHome2, { recursive: true, force: true });
1613+
} catch {
1614+
// best-effort
1615+
}
1616+
15821617
// ── Round 98: parseSessionFilename with null input throws TypeError ──
15831618
console.log('\nRound 98: parseSessionFilename (null input — crashes at line 30):');
15841619

0 commit comments

Comments
 (0)