diff --git a/apps/desktop/src/app/settings/config-settings.test.tsx b/apps/desktop/src/app/settings/config-settings.test.tsx index 3b388d1cd3..fb42ea448a 100644 --- a/apps/desktop/src/app/settings/config-settings.test.tsx +++ b/apps/desktop/src/app/settings/config-settings.test.tsx @@ -3,7 +3,9 @@ import { cleanup, render, screen } from '@testing-library/react' import { atom } from 'nanostores' import { createRef } from 'react' import { MemoryRouter } from 'react-router' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest' + +import type { ConfigSettings as ConfigSettingsType } from './config-settings' const getHermesConfigRecord = vi.fn() const getHermesConfigSchema = vi.fn() @@ -36,6 +38,15 @@ vi.mock('@/store/projects', () => ({ scanAndRecordRepos: vi.fn().mockResolvedValue(undefined) })) +// The module graph behind ConfigSettings is large (1.5s cold here, >10s on a +// saturated CI runner); load it once under the hook timeout so the 15s test +// budget is spent on the autosave behaviour, not on transform + import. +let ConfigSettings: typeof ConfigSettingsType + +beforeAll(async () => { + ;({ ConfigSettings } = await import('./config-settings')) +}, 60_000) + beforeEach(() => { getElevenLabsVoices.mockResolvedValue({ available: false }) getHermesConfigSchema.mockResolvedValue({ fields: {} }) @@ -47,8 +58,7 @@ afterEach(() => { vi.clearAllMocks() }) -async function renderConfigSettings() { - const { ConfigSettings } = await import('./config-settings') +function renderConfigSettings() { const client = new QueryClient({ defaultOptions: { queries: { retry: false } } }) const importInputRef = createRef() @@ -70,7 +80,7 @@ describe('ConfigSettings autosave', () => { vi.useFakeTimers({ shouldAdvanceTime: true }) try { - await renderConfigSettings() + renderConfigSettings() const toggle = await screen.findByRole('switch')