Files
Codeman/test/setup.ts
T

25 lines
898 B
TypeScript
Raw Normal View History

/**
2026-02-26 16:44:34 +01:00
* @fileoverview Global test setup for Codeman tests
*
2026-02-18 12:51:35 +01:00
* SAFETY: TmuxManager has built-in test mode detection
* (via process.env.VITEST) that makes ALL shell commands no-ops.
2026-02-18 12:51:35 +01:00
* This means tests CANNOT kill, create, or interact with real tmux
* sessions regardless of what the test code does.
*
2026-06-08 10:19:38 -04:00
* This setup file strips shell-level auth configuration that can leak from a
* running Codeman instance, then handles mock/timer cleanup between tests.
*/
import { afterEach, vi } from 'vitest';
2026-06-08 10:19:38 -04:00
delete process.env.CODEMAN_PASSWORD;
delete process.env.CODEMAN_USERNAME;
// Gesture availability changes renderIndexHtml output (injects the
// __codemanGestureAvailable flag), breaking byte-identity assertions
// (test/server-index-title.test.ts) when the shell exports CODEMAN_GESTURE=1.
delete process.env.CODEMAN_GESTURE;
2026-06-08 10:19:38 -04:00
2026-01-30 22:25:59 +01:00
afterEach(() => {
vi.clearAllMocks();
vi.useRealTimers();
});