From 65aed734e9f32c126879ec88bcbd7fce61c77d08 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Sun, 22 Mar 2026 11:17:26 -0400 Subject: [PATCH] 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 Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/init.test.cjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/init.test.cjs b/tests/init.test.cjs index d6769ea82..c4f21e11c 100644 --- a/tests/init.test.cjs +++ b/tests/init.test.cjs @@ -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);