Skip to content

Commit 04d99c5

Browse files
committed
test(claude): parameterize config source
Removed the hard-coded instruction to copy /Users/ohadassulin/vs-code-projects/twitter_research/.claude. The Claude interrupt test now expects CLAUDE_INTERRUPT_SOURCE to point at the desired .claude directory, skips when the env isn�t provided, and copies/loads settings from that path before running.
1 parent 9c55b62 commit 04d99c5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

examples/src/claude-interrupt.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ import { ensureAdaptersRegistered } from './register-adapters';
1111
const WORKSPACE = process.env.CLAUDE_INTERRUPT_WORKSPACE ?? '/tmp/headless-coder-sdk/test_claude_interrupt';
1212
const CONNECT_FOUR_PROMPT =
1313
'Program a web-based Connect Four game that tracks the winner and allows restarting without refreshing the page.';
14-
const CLAUDE_CONFIG_SOURCE =
15-
process.env.CLAUDE_INTERRUPT_SOURCE ?? path.resolve(process.cwd(), '..', '.claude');
14+
const CLAUDE_CONFIG_SOURCE = process.env.CLAUDE_INTERRUPT_SOURCE;
1615

1716
ensureAdaptersRegistered();
1817

1918
/**
2019
* Verifies Claude streams provide cancellation metadata when interrupted.
2120
*/
2221
test('claude run can be interrupted', async () => {
22+
if (!CLAUDE_CONFIG_SOURCE) {
23+
test.skip('CLAUDE_INTERRUPT_SOURCE env not set; skipping Claude interrupt test.');
24+
return;
25+
}
26+
2327
await rm(WORKSPACE, { recursive: true, force: true });
2428
await mkdir(WORKSPACE, { recursive: true });
25-
await prepareClaudeWorkspace(WORKSPACE);
29+
await prepareClaudeWorkspace(WORKSPACE, CLAUDE_CONFIG_SOURCE);
2630

2731
const coder = createCoder(CLAUDE_CODER, {
2832
workingDirectory: WORKSPACE,
@@ -63,10 +67,10 @@ test('claude run can be interrupted', async () => {
6367
assert.ok(sawCancelled || sawInterruptedError, 'expected Claude to emit cancellation metadata');
6468
});
6569

66-
async function prepareClaudeWorkspace(workspace: string): Promise<void> {
70+
async function prepareClaudeWorkspace(workspace: string, sourceDir: string): Promise<void> {
6771
const configDir = path.join(workspace, '.claude');
6872
await rm(configDir, { recursive: true, force: true });
69-
await cp(CLAUDE_CONFIG_SOURCE, configDir, { recursive: true });
73+
await cp(sourceDir, configDir, { recursive: true });
7074
process.env.CLAUDE_CONFIG_DIR = configDir;
7175
await loadClaudeSettings(configDir);
7276
}

0 commit comments

Comments
 (0)