mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 21:14:35 -07:00
Shorten temp directory (#17901)
This commit is contained in:
@@ -10,6 +10,42 @@ if (process.env.NO_COLOR !== undefined) {
|
||||
}
|
||||
|
||||
import { setSimulate429 } from './src/utils/testUtils.js';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
// Disable 429 simulation globally for all tests
|
||||
setSimulate429(false);
|
||||
|
||||
// Default mocks for Storage and ProjectRegistry to prevent disk access in most tests.
|
||||
// These can be overridden in specific tests using vi.unmock().
|
||||
|
||||
vi.mock('./src/config/projectRegistry.js', async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import('./src/config/projectRegistry.js')>();
|
||||
actual.ProjectRegistry.prototype.initialize = vi.fn(() =>
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
actual.ProjectRegistry.prototype.getShortId = vi.fn(() =>
|
||||
Promise.resolve('project-slug'),
|
||||
);
|
||||
return actual;
|
||||
});
|
||||
|
||||
vi.mock('./src/config/storageMigration.js', async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import('./src/config/storageMigration.js')>();
|
||||
actual.StorageMigration.migrateDirectory = vi.fn(() =>
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
return actual;
|
||||
});
|
||||
|
||||
vi.mock('./src/config/storage.js', async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import('./src/config/storage.js')>();
|
||||
actual.Storage.prototype.initialize = vi.fn(() => Promise.resolve(undefined));
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(actual.Storage.prototype as any).getProjectIdentifier = vi.fn(
|
||||
() => 'project-slug',
|
||||
);
|
||||
return actual;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user