diff --git a/apps/console/src/__tests__/public-contract.test.ts b/apps/console/src/__tests__/public-contract.test.ts index dab4da7a80..4b54b0f0cf 100644 --- a/apps/console/src/__tests__/public-contract.test.ts +++ b/apps/console/src/__tests__/public-contract.test.ts @@ -25,8 +25,23 @@ * silently disappeared; an exact list makes both directions a deliberate edit. */ -import { describe, it, expect, beforeAll } from 'vitest'; +import { describe, it, expect } from 'vitest'; import { ComponentRegistry, PUBLIC_BLOCKS, type PublicComponentConfig } from '@object-ui/core'; +// The two graphs whose registrations this file reads. At module scope, NOT +// awaited inside a `beforeAll` — there their cold transform is billed to the +// hook, against `hookTimeout`, which is why this needed a 60s budget. The import +// phase has no test/hook timeout, so the raised timeout goes away rather than +// getting raised again (objectui#3010). See AGENTS.md §9 (test discipline). +// +// Loading them here rather than in a hook does not change WHAT is loaded, so the +// eager/lazy split the assertions below pin is untouched: static imports are +// evaluated in order before the module body, and the shared setup still runs +// before this module is imported at all. +// +// The layout/content primitives (Tier B) … +import '@object-ui/components'; +// … and the console's own plugin layer, from the module main.tsx boots from. +import '../register-plugins'; /** * Every curated tag the console makes available, in `PUBLIC_BLOCKS` order. @@ -109,15 +124,11 @@ const EXPECTED_LAZY = [ 'markdown', ]; -let contract: Map; - -beforeAll(async () => { - // The layout/content primitives (Tier B) … - await import('@object-ui/components'); - // … and the console's own plugin layer, from the module main.tsx boots from. - await import('../register-plugins'); - contract = new Map(ComponentRegistry.getPublicConfigs().map((c) => [c.type, c])); -}, 60000); +// Safe at module scope: the two side-effect imports at the top of this file are +// evaluated before the module body, so every registration is already in place. +const contract: Map = new Map( + ComponentRegistry.getPublicConfigs().map((c) => [c.type, c]), +); describe('console ↔ PUBLIC_BLOCKS coverage', () => { it('exposes every curated block the console ships, eager or lazy', () => { diff --git a/packages/plugin-charts/src/index.test.ts b/packages/plugin-charts/src/index.test.ts index b683c4d65b..62b76e6306 100644 --- a/packages/plugin-charts/src/index.test.ts +++ b/packages/plugin-charts/src/index.test.ts @@ -6,15 +6,17 @@ * LICENSE file in the root directory of this source tree. */ -import { describe, it, expect, beforeAll } from 'vitest'; +import { describe, it, expect } from 'vitest'; import { ComponentRegistry } from '@object-ui/core'; +// Imports all renderers to register them. Module scope, NOT awaited inside a +// `beforeAll` — there the cold transform of the (recharts-backed) renderer graph +// is billed to the hook, which is why this needed a 60s `hookTimeout` to begin +// with. The import phase has no test/hook timeout, so the raised timeout goes +// away rather than getting raised again (objectui#3010). +// See AGENTS.md §9 (test discipline). +import './index'; describe('Plugin Charts', () => { - // Import all renderers to register them - beforeAll(async () => { - await import('./index'); - }, 60000); - describe('bar-chart component', () => { it('should be registered in ComponentRegistry', () => { const chartBarRenderer = ComponentRegistry.get('bar-chart'); diff --git a/packages/plugin-editor/src/index.test.ts b/packages/plugin-editor/src/index.test.ts index c30c4a913d..b936519dfe 100644 --- a/packages/plugin-editor/src/index.test.ts +++ b/packages/plugin-editor/src/index.test.ts @@ -6,16 +6,17 @@ * LICENSE file in the root directory of this source tree. */ -import { describe, it, expect, beforeAll } from 'vitest'; +import { describe, it, expect } from 'vitest'; import { ComponentRegistry } from '@object-ui/core'; +// Imports all renderers to register them. Module scope, NOT awaited inside a +// `beforeAll` — Monaco is a heavy library, and loading it inside the hook billed +// that cost against `hookTimeout`, which is why this needed a 30s budget. The +// import phase has no test/hook timeout, so the raised timeout goes away rather +// than getting raised again (objectui#3010). +// See AGENTS.md §9 (test discipline). +import './index'; describe('Plugin Editor', () => { - // Import all renderers to register them - // Note: Monaco Editor is a heavy library that takes time to load - beforeAll(async () => { - await import('./index'); - }, 30000); // 30 second timeout for Monaco Editor initialization - describe('code-editor component', () => { it('should be registered in ComponentRegistry', () => { const editorRenderer = ComponentRegistry.get('code-editor'); diff --git a/packages/plugin-markdown/src/index.test.ts b/packages/plugin-markdown/src/index.test.ts index 70b0ae970a..381b188ae8 100644 --- a/packages/plugin-markdown/src/index.test.ts +++ b/packages/plugin-markdown/src/index.test.ts @@ -6,15 +6,18 @@ * LICENSE file in the root directory of this source tree. */ -import { describe, it, expect, beforeAll } from 'vitest'; +import { describe, it, expect } from 'vitest'; import { ComponentRegistry } from '@object-ui/core'; +// Imports all renderers to register them. Module scope, NOT awaited inside a +// `beforeAll` — there the cold transform of the renderer graph is billed to the +// hook, against `hookTimeout`. That is what made the sibling plugin-kanban test +// blow its raised 15s budget at 15021ms under full parallel load +// (objectui#3010); this file's timed portion was already at 5.83s of the same +// 15s. The import phase has no test/hook timeout, so no raised timeout is +// needed. See AGENTS.md §9 (test discipline). +import './index'; describe('Plugin Markdown', () => { - // Import all renderers to register them - beforeAll(async () => { - await import('./index'); - }, 15000); // Increase timeout to 15 seconds for async import - describe('markdown component', () => { it('should be registered in ComponentRegistry', () => { const markdownRenderer = ComponentRegistry.get('markdown');