This commit is contained in:
A.K.M. Adib
2026-04-23 09:35:17 -04:00
parent 296802c359
commit a6c7f1cf95
3 changed files with 2 additions and 18 deletions
@@ -3343,15 +3343,6 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
};
export function getSettingsSchema(): SettingsSchemaType {
// Force enablePermanentToolApproval to false in Vitest to keep snapshots stable,
// unless explicitly overridden in tests or during doc generation.
if (process.env['VITEST'] && !process.env['GENERATE_DOCS']) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const schema = JSON.parse(JSON.stringify(SETTINGS_SCHEMA));
schema.security.properties.enablePermanentToolApproval.default = false;
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return schema;
}
return SETTINGS_SCHEMA;
}
@@ -17,7 +17,6 @@ vi.mock('fs', () => ({
describe('generate-settings-doc', () => {
it('keeps documentation in sync in check mode', async () => {
vi.stubEnv('GENERATE_DOCS', 'true');
const previousExitCode = process.exitCode;
try {
process.exitCode = 0;
@@ -25,7 +24,6 @@ describe('generate-settings-doc', () => {
expect(process.exitCode).toBe(0);
} finally {
process.exitCode = previousExitCode;
vi.unstubAllEnvs();
}
});
});
@@ -21,14 +21,9 @@ vi.mock('fs', () => ({
describe('generate-settings-schema', () => {
it('keeps schema in sync in check mode', async () => {
vi.stubEnv('GENERATE_DOCS', 'true');
const previousExitCode = process.exitCode;
try {
await expect(generateSchema(['--check'])).resolves.toBeUndefined();
expect(process.exitCode).toBe(previousExitCode);
} finally {
vi.unstubAllEnvs();
}
await expect(generateSchema(['--check'])).resolves.toBeUndefined();
expect(process.exitCode).toBe(previousExitCode);
});
it('includes $schema property in generated schema', async () => {