diff --git a/apps/sim/blocks/blocks/outlook.test.ts b/apps/sim/blocks/blocks/outlook.test.ts index cd60240b048..c8b36c5ad46 100644 --- a/apps/sim/blocks/blocks/outlook.test.ts +++ b/apps/sim/blocks/blocks/outlook.test.ts @@ -5,6 +5,12 @@ import { describe, expect, it } from 'vitest' import { tools as toolRegistry } from '@/tools/registry' import { OutlookBlock } from './outlook' +/** + * Uses the real tool registry: these assertions are about tool registration and + * params, which the global `@/tools/registry` mock in vitest.setup.ts empties. + */ +vi.unmock('@/tools/registry') + const block = OutlookBlock /** Every calendar operation exposed by the block's operation dropdown. */ diff --git a/apps/sim/lib/workflows/search-replace/indexer.test.ts b/apps/sim/lib/workflows/search-replace/indexer.test.ts index 2fe792b2073..e970b80c787 100644 --- a/apps/sim/lib/workflows/search-replace/indexer.test.ts +++ b/apps/sim/lib/workflows/search-replace/indexer.test.ts @@ -10,6 +10,17 @@ import { } from '@/lib/workflows/search-replace/search-replace.fixtures' import { WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS } from '@/lib/workflows/search-replace/subflow-fields' +/** + * Uses the real tool registry. Nothing here imports it directly — the dependency + * is transitive: the search-replace planner resolves tool input params through + * real subblock configs, so the global `@/tools/registry` mock in + * vitest.setup.ts empties the data these assertions read. + * + * Not a no-op, despite the lack of a direct import. Dropping this opt-out fails + * 8 tests across this file and its sibling suite. + */ +vi.unmock('@/tools/registry') + describe('indexWorkflowSearchMatches', () => { it('finds plain text matches across nested subblock values', () => { const workflow = createSearchReplaceWorkflowFixture() diff --git a/apps/sim/lib/workflows/search-replace/replacements.test.ts b/apps/sim/lib/workflows/search-replace/replacements.test.ts index 354dff37f8c..340fa434350 100644 --- a/apps/sim/lib/workflows/search-replace/replacements.test.ts +++ b/apps/sim/lib/workflows/search-replace/replacements.test.ts @@ -10,6 +10,17 @@ import { } from '@/lib/workflows/search-replace/search-replace.fixtures' import { WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS } from '@/lib/workflows/search-replace/subflow-fields' +/** + * Uses the real tool registry. Nothing here imports it directly — the dependency + * is transitive: the search-replace planner resolves tool input params through + * real subblock configs, so the global `@/tools/registry` mock in + * vitest.setup.ts empties the data these assertions read. + * + * Not a no-op, despite the lack of a direct import. Dropping this opt-out fails + * 8 tests across this file and its sibling suite. + */ +vi.unmock('@/tools/registry') + describe('buildWorkflowSearchReplacePlan', () => { it('replaces selected text ranges across blocks without touching unselected matches', () => { const workflow = createSearchReplaceWorkflowFixture() diff --git a/apps/sim/tools/azure_devops/azure-devops.test.ts b/apps/sim/tools/azure_devops/azure-devops.test.ts index 104232b18a5..520b143675e 100644 --- a/apps/sim/tools/azure_devops/azure-devops.test.ts +++ b/apps/sim/tools/azure_devops/azure-devops.test.ts @@ -45,6 +45,12 @@ const baseParams = { accessToken: 'pat-token', } +/** + * Uses the real tool registry: these assertions are about tool registration and + * params, which the global `@/tools/registry` mock in vitest.setup.ts empties. + */ +vi.unmock('@/tools/registry') + const authHeader = `Basic ${Buffer.from(':pat-token').toString('base64')}` const allTools = [ diff --git a/apps/sim/vitest.config.ts b/apps/sim/vitest.config.ts index cd5eea87377..453c0009b74 100644 --- a/apps/sim/vitest.config.ts +++ b/apps/sim/vitest.config.ts @@ -25,13 +25,6 @@ export default defineConfig({ fileParallelism: true, maxConcurrency: 10, testTimeout: 10000, - deps: { - optimizer: { - web: { - enabled: true, - }, - }, - }, }, resolve: { alias: [ diff --git a/apps/sim/vitest.setup.ts b/apps/sim/vitest.setup.ts index 82760d33715..25c34639607 100644 --- a/apps/sim/vitest.setup.ts +++ b/apps/sim/vitest.setup.ts @@ -97,6 +97,20 @@ vi.mock('@/stores/execution/store', () => ({ useLastRunEdges: vi.fn().mockReturnValue(new Map()), })) +/** + * The tool registry is 4,351 entries pulling ~5,907 modules, and almost nothing + * under test needs the real thing — but every test file that transitively + * reaches it paid to import the whole graph. Measured on the full suite: + * import 1,347s -> 633s, transform 130s -> 53s. + * + * `@/blocks/registry` is mocked the same way directly below, for the same reason. + * + * Tests that genuinely assert registration or tool params opt out with + * `vi.unmock('@/tools/registry')` at the top of the file — see + * blocks/blocks/outlook.test.ts for the pattern. + */ +vi.mock('@/tools/registry', () => ({ tools: {} })) + vi.mock('@/blocks/registry', () => ({ getBlock: vi.fn(() => ({ name: 'Mock Block', @@ -107,6 +121,8 @@ vi.mock('@/blocks/registry', () => ({ })), getAllBlocks: vi.fn(() => []), getLatestBlock: vi.fn(() => undefined), + /** Mirrors the real module's accessor; without it consumers get "not a function". */ + getBlockRegistry: vi.fn(() => ({})), getBlockByToolName: vi.fn((toolName: string) => toolName.startsWith('gmail_') ? {