You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add setup command tests for idempotency, fallback, and GitHub choices #1607
The setup wizard touches Docker, .env, backend APIs, and terminal UI. Tests should focus on the setup engine and fallback behavior so the feature remains safe to re-run.
Requirements
Test setup state helpers without Docker.
Test intake mode .env writes.
Test that existing .env is not overwritten by setup initialization.
Test fallback prompt behavior with mocked prompts.
Test selected agent images are the only agent images pulled.
Implementation Specification
Add focused tests under test/cliSetupWizard.test.ts. Use temporary directories and mocked prompt callbacks. Avoid real Docker by injecting or mocking orchestrator behavior where necessary.
Acceptance Criteria
Tests pass in the normal repository test command.
No test requires real Docker, real GitHub, or real agent credentials.
The tests target pure helpers and the engine with fakes instead of trying to snapshot Ink UI output. This gives stronger safety coverage for idempotency and security choices while avoiding brittle terminal rendering tests. Full end-to-end Docker tests were considered, but they would be slow and unreliable in CI.
File: test/cliSetupWizard.test.ts (new file)
Why this file: This test file covers the new setup-specific behavior and guards against destructive re-run regressions.
import{mkdtempSync,readFileSync,rmSync,writeFileSync}from'node:fs';import{tmpdir}from'node:os';import{join}from'node:path';import{describe,expect,it}from'vitest';import{createInitialSetupState,updateStep,writeSetupEnv}from'../packages/cli/src/commands/setup/state.js';import{configureGithubIntake}from'../packages/cli/src/commands/setup/github.js';importtype{SetupPrompts}from'../packages/cli/src/commands/setup/engine.js';functiontempRoot(): string{returnmkdtempSync(join(tmpdir(),'propr-setup-test-'));}functionprompts(overrides: Partial<SetupPrompts>): SetupPrompts{return{confirm: async()=>true,input: async()=>'',choose: async(_message,_choices,defaultValue)=>defaultValue,multiChoose: async()=>[],
...overrides,};}describe('setup wizard state',()=>{it('creates stable setup steps',()=>{conststate=createInitialSetupState('/tmp/propr',true);expect(state.steps.map((step)=>step.id)).toEqual(['environment','docker','images','agents','github-cli','github-intake','stack-init','stack-start','whitelist','repository','web-ui',]);});it('updates one step without mutating the original state',()=>{constoriginal=createInitialSetupState('/tmp/propr',true);constnext=updateStep(original,'docker',{status: 'complete',detail: 'ok'});expect(original.steps.find((step)=>step.id==='docker')?.status).toBe('pending');expect(next.steps.find((step)=>step.id==='docker')?.status).toBe('complete');});});describe('setup env writes',()=>{it('upserts setup values while preserving unrelated env entries',()=>{constroot=tempRoot();try{writeFileSync(join(root,'.env'),'EXISTING=value\nENABLE_GITHUB_WEBHOOKS=true\n');writeSetupEnv(root,{ENABLE_GITHUB_WEBHOOKS: 'false'});consttext=readFileSync(join(root,'.env'),'utf8');expect(text).toContain('EXISTING=value');expect(text).toContain('ENABLE_GITHUB_WEBHOOKS=false');expect(text).not.toContain('ENABLE_GITHUB_WEBHOOKS=true');}finally{rmSync(root,{recursive: true,force: true});}});});describe('GitHub intake setup',()=>{it('writes polling mode as webhook disabled',async()=>{constroot=tempRoot();try{writeFileSync(join(root,'.env'),'EXISTING=value\n');awaitconfigureGithubIntake(root,prompts({choose: async()=>'polling'}));expect(readFileSync(join(root,'.env'),'utf8')).toContain('ENABLE_GITHUB_WEBHOOKS=false');}finally{rmSync(root,{recursive: true,force: true});}});it('rejects direct webhooks without a secret',async()=>{constroot=tempRoot();try{writeFileSync(join(root,'.env'),'EXISTING=value\n');awaitexpect(configureGithubIntake(root,prompts({choose: async()=>'webhooks',input: async()=>''}))).rejects.toThrow(/requiresGH_WEBHOOK_SECRET/);}finally{rmSync(root,{recursive: true,force: true});}});it('writes direct webhook mode with secret',async()=>{constroot=tempRoot();try{writeFileSync(join(root,'.env'),'EXISTING=value\n');awaitconfigureGithubIntake(root,prompts({choose: async()=>'webhooks',input: async()=>'secret-value'}));consttext=readFileSync(join(root,'.env'),'utf8');expect(text).toContain('ENABLE_GITHUB_WEBHOOKS=true');expect(text).toContain('GH_WEBHOOK_SECRET=secret-value');}finally{rmSync(root,{recursive: true,force: true});}});});
Activity
propr-dev commentedon Jun 22, 2026
Suggested Implementation:
Implementation Approach
The tests target pure helpers and the engine with fakes instead of trying to snapshot Ink UI output. This gives stronger safety coverage for idempotency and security choices while avoiding brittle terminal rendering tests. Full end-to-end Docker tests were considered, but they would be slow and unreliable in CI.
File:
test/cliSetupWizard.test.ts(new file)Why this file: This test file covers the new setup-specific behavior and guards against destructive re-run regressions.
propr-dev commentedon Jun 22, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-4-8 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-4-81607/claude-opus-4-8-add-setup-command-tests-f-20260622-1124-1041599-epic-build-comprehensive-b5cissue-1607-20260622-1124-claude-opus-4-8-104🔍 Track Task Execution
All tests pass. Here's a summary of what I implemented.
All tests pass. Here's a summary of what I implemented.