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
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

import { describe, it, expect } from 'vitest';
// `createSeed` reaches the page synthesizer through a dynamic
// `await import('@object-ui/plugin-detail')` (anchors.ts), so the cold transform
// of that whole package graph is billed to whichever test first awaits the hook
// — inside the test body, against the 15s `testTimeout`. The `unit` project runs
// `isolate: false`, so whether the module is already warm depends on what else
// the worker happened to run first; when it wasn't, the seeding test blew the
// budget. (It surfaced as a timeout rather than a wrong result because
// `createSeed` swallows failures and returns `{}`.)
//
// Importing it here moves that cost into the file's import phase, which no test
// or hook timeout applies to, so it can never land inside a timed window again.
// Keep the specifier identical to the one in anchors.ts — ESM caches by resolved
// specifier, so this makes the hook's own dynamic import resolve immediately.
import '@object-ui/plugin-detail';
import { registerBuiltinAnchors } from './anchors';
import { resolveResourceConfig } from './registry';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

import { describe, it, expect, vi, afterEach } from 'vitest';
import { render, screen, cleanup, waitFor } from '@testing-library/react';
// DatasetPreview renders its chart behind
// `React.lazy(() => import('@object-ui/plugin-charts'))`, and the "use the right
// axis" caption asserted on below lives *inside* that Suspense boundary — so it
// only exists once the (recharts-backed) chunk resolves. Loading it is unbounded
// work: under full-suite parallelism Vite's transform pipeline is saturated and
// the first import of the package graph can outlast RTL's 1000ms
// `waitFor`/`findBy` window. The earlier tests in this file assert on the table,
// which renders *outside* the boundary, so they start the import but never wait
// for it — leaving the ratio-measure test to race a load already in flight.
//
// Importing it here moves that cost into the file's import phase, which no test
// or hook timeout applies to, instead of widening any assertion window. Keep the
// specifier identical to DatasetPreview.tsx's — ESM caches by resolved specifier,
// so this makes the component's own `React.lazy` factory resolve immediately.
import '@object-ui/plugin-charts';
import { DatasetPreview } from './DatasetPreview';

// Mock the data adapter the preview pulls from AdapterProvider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

import { describe, it, expect, vi, afterEach } from 'vitest';
import { render, screen, cleanup, waitFor } from '@testing-library/react';
// ReportPreview renders the runtime report renderer behind
// `React.lazy(() => import('@object-ui/plugin-report'))`, so nothing below the
// Suspense boundary — including the `queryDataset` call the assertions wait on —
// exists until that chunk resolves. Loading it is unbounded work: under
// full-suite parallelism Vite's transform pipeline is saturated (the `dom-heavy`
// project alone spends ~60s in transform) and the first import of the package
// graph can outlast RTL's 1000ms `waitFor`/`findBy` window. Measured under a real
// full run, this import alone took 312/424/976ms across three runs — that last
// one is 97.6% of the entire assertion budget. The assertions then raced the
// module loader and failed against the "Loading report renderer…" fallback —
// only in the first tests of the file, because later ones find the module warm.
//
// Importing it here moves that cost into the file's import phase, which no test
// or hook timeout applies to, instead of widening any assertion window. Keep the
// specifier identical to ReportPreview.tsx's — ESM caches by resolved specifier,
// so this makes the component's own `React.lazy` factory resolve immediately.
import '@object-ui/plugin-report';
import { ReportPreview } from './ReportPreview';

// Mock the data adapter the preview pulls from AdapterProvider.
Expand Down
9 changes: 8 additions & 1 deletion packages/i18n/src/__tests__/all-locales-key-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ describe('all locale packs are at full key parity with en (objectui#2872)', () =
});

it.each(OTHER_LOCALES)('%s defines every en key', (lang) => {
const missing = [...EN].filter((k) => !keysOf(builtInLocales[lang]).has(k)).sort();
// Build the pack's key set ONCE. Calling `keysOf` inside the predicate
// re-walks the whole locale tree per `en` key (~2.5k keys x a full
// recursive walk), which made this quadratic: ~850-2200ms per locale
// isolated, and >15s — a timeout, not a parity failure — once full-suite
// contention slowed each walk down. The sibling assertion below always
// hoisted it; this one didn't.
const packKeys = keysOf(builtInLocales[lang]);
const missing = [...EN].filter((k) => !packKeys.has(k)).sort();
expect(missing, `${lang} is missing ${missing.length} key(s)`).toEqual([]);
});

Expand Down
15 changes: 9 additions & 6 deletions packages/plugin-kanban/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';
// Import all renderers to register them. This was a `beforeAll(async () => {
// await import('./index') }, 15000)` — the cold transform of the renderer graph
// was billed to a hook, so it needed its timeout raised to 15s, and under full
// parallel load it blew even that (observed: 15021ms, reported as 8 skipped tests
// rather than a failed assertion). A static import puts the same cost in the
// file's import phase, which no test or hook timeout applies to — so the raised
// timeout is no longer needed at all.
import './index';

describe('Plugin Kanban', () => {
// Import all renderers to register them
beforeAll(async () => {
await import('./index');
}, 15000); // Increase timeout to 15 seconds for async import

describe('kanban component', () => {
it('should be registered in ComponentRegistry', () => {
const kanbanRenderer = ComponentRegistry.get('kanban-ui');
Expand Down
Loading