|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | import { describe, it, expect, afterEach } from 'vitest'; |
| 7 | +import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'; |
| 8 | +import { tmpdir } from 'node:os'; |
| 9 | +import { join } from 'node:path'; |
7 | 10 | import { TerminalHarness } from './acceptance/harness.js'; |
8 | 11 |
|
9 | 12 | describe('UX Gates', () => { |
10 | 13 | let harness: TerminalHarness | null = null; |
| 14 | + let projectDir: string | null = null; |
11 | 15 |
|
12 | 16 | afterEach(async () => { |
13 | 17 | if (harness) { |
14 | 18 | await harness.close(); |
15 | 19 | harness = null; |
16 | 20 | } |
| 21 | + if (projectDir) { |
| 22 | + rmSync(projectDir, { recursive: true, force: true }); |
| 23 | + projectDir = null; |
| 24 | + } |
17 | 25 | }); |
18 | 26 |
|
19 | 27 | it('No overflow beyond terminal width (80 chars)', async () => { |
@@ -64,8 +72,11 @@ describe('UX Gates', () => { |
64 | 72 | }); |
65 | 73 |
|
66 | 74 | it('Status command shows clear output structure', async () => { |
67 | | - harness = await TerminalHarness.spawnWithArgs(['status']); |
68 | | - await harness.waitForExit(5000); |
| 75 | + projectDir = mkdtempSync(join(tmpdir(), 'squad-ux-gates-')); |
| 76 | + mkdirSync(join(projectDir, '.squad')); |
| 77 | + writeFileSync(join(projectDir, '.squad', 'team.md'), '# UX test team\n'); |
| 78 | + harness = await TerminalHarness.spawnWithArgs(['status'], { cwd: projectDir }); |
| 79 | + expect(await harness.waitForExit(5000)).toBe(0); |
69 | 80 |
|
70 | 81 | const output = harness.captureFrame(); |
71 | 82 |
|
|
0 commit comments