Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions apps/console/src/__tests__/public-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -109,15 +124,11 @@ const EXPECTED_LAZY = [
'markdown',
];

let contract: Map<string, PublicComponentConfig>;

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<string, PublicComponentConfig> = 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', () => {
Expand Down
14 changes: 8 additions & 6 deletions packages/plugin-charts/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
15 changes: 8 additions & 7 deletions packages/plugin-editor/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
15 changes: 9 additions & 6 deletions packages/plugin-markdown/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -32,7 +35,7 @@

it('should have expected inputs', () => {
const config = ComponentRegistry.getConfig('markdown');
const inputNames = config?.inputs?.map((input: any) => input.name) || [];

Check warning on line 38 in packages/plugin-markdown/src/index.test.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

expect(inputNames).toContain('content');
expect(inputNames).toContain('className');
Expand All @@ -40,7 +43,7 @@

it('should have content as required input', () => {
const config = ComponentRegistry.getConfig('markdown');
const contentInput = config?.inputs?.find((input: any) => input.name === 'content');

Check warning on line 46 in packages/plugin-markdown/src/index.test.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

expect(contentInput).toBeDefined();
expect(contentInput?.required).toBe(true);
Expand Down
Loading