mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-19 16:23:06 -07:00
fix(cli): resolve settings test failures by updating mock and using truly invalid JSON
This commit is contained in:
@@ -80,9 +80,14 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('../utils/commentJson.js', () => ({
|
||||
updateSettingsFilePreservingFormat: vi.fn(),
|
||||
}));
|
||||
vi.mock('../utils/commentJson.js', async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import('../utils/commentJson.js')>();
|
||||
return {
|
||||
...actual,
|
||||
updateSettingsFilePreservingFormat: vi.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('strip-json-comments', () => ({
|
||||
default: vi.fn((content) => content),
|
||||
|
||||
@@ -152,7 +152,7 @@ describe('Settings Validation Warning', () => {
|
||||
);
|
||||
|
||||
(fs.readFileSync as Mock).mockImplementation((p: string) => {
|
||||
if (p === USER_SETTINGS_PATH) return '{ "invalid": "json", }'; // Trailing comma is invalid in standard JSON
|
||||
if (p === USER_SETTINGS_PATH) return '{ "invalid": "json"'; // Unclosed brace is invalid
|
||||
return '{}';
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user