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