fix: handle missing config.json in text_mode test

The test tried to fs.readFileSync on config.json which doesn't exist
in createTempProject() fixtures. Now gracefully creates the config
from scratch when the file is missing.

Co-Authored-By: GhadiSaab <GhadiSaab@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-03-22 11:17:26 -04:00
parent a74e6b1e94
commit 65aed734e9

View File

@@ -63,8 +63,10 @@ describe('init commands', () => {
test('init plan-phase exposes text_mode true when set in config', () => {
const configPath = path.join(tmpDir, '.planning', 'config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
config.workflow = { ...(config.workflow || {}), text_mode: true };
const existing = fs.existsSync(configPath)
? JSON.parse(fs.readFileSync(configPath, 'utf8'))
: {};
const config = { ...existing, workflow: { ...(existing.workflow || {}), text_mode: true } };
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
const result = runGsdTools('init plan-phase 03', tmpDir);