docs/plans/2026-03-09-test-suite-excellence-plan.md
bun test as the single default run. The suite is already fast enough that quality matters more than orchestration.@platejs/slate@platejs/utils, @udecode/react-utils, @udecode/utils@platejs/core@platejs/slatecreateEditor legacy sync.@platejs/slate contracts.../slate scan[ ] slate-react/test/chunking.spec.ts: save chunk/index-stability ideas for @platejs/core[x] slate-react/test/decorations.spec.tsx: adapt later in @platejs/core[x] slate-react/test/editable.spec.tsx: keep change-callback partitioning ideas for @platejs/core[ ] slate-react/test/react-editor.spec.tsx: skip unless a Plate DOM bug forces it[x] slate-react/test/use-selected.spec.tsx: adapt later in @platejs/core[x] slate-react/test/use-slate-selector.spec.tsx: reuse in utility and core selector tests[x] slate-react/test/use-slate.spec.tsx: adapt later in @platejs/core[ ] playwright/integration/examples/*: explicitly out@platejs/core already has a wider runtime base but still needs the serious type-contract pass.testing.mdc as the permanent rulebook. Do not recreate giant cleanup-plan docs unless new durable policy appears.type-tests, and small package-local test helpers only.@platejs/utils stays runtime-first. Cover ExitBreakPlugin, selection hooks, useSelectionFragment, useEditorString, useMarkToolbarButton, useRemoveNodeButton, and only the real branchy parts of BlockPlaceholderPlugin.createSlateEditor for plugin behavior and selector-backed hook state. Use rendered React tests only for hook props, click handlers, and placeholder rerender semantics.@udecode/react-utils gets direct behavior tests for createPrimitiveComponent, createPrimitiveElement, createSlotComponent, useEffectOnce, useOnClickOutside, useStableFn, useStableMemo, withRef, and PortalBody.Box, Text, or MemoizedChildren unless a real branch or regression shows up.@udecode/utils covers findHtmlParentElement, sanitizeUrl, isUrl, mergeProps, hexToBase64, and escapeRegexp/getHandler only where branches still matter. Skip pure type alias files and environment.ts unless its runtime Apple detection logic is actually used in package behavior.use-slate-selector invariant in phase 2 for selector equality and stale-rerender prevention where it maps cleanly.@platejs/corepackages/core/type-tests into multiple focused fixtures covering createSlatePlugin, createTSlatePlugin, createPlatePlugin, createPlateEditor, withSlate, withPlate, plugin API merging, option merging, and editor or plugin inference.@ts-expect-error negatives. Do not mix these checks into Bun runtime specs.../slate/packages/slate-react/test by invariant, not by file copy:
use-slate-selector for equality and stale-rerender preventionuse-slate for editor version and subscription behavioruse-selected for selection rerender and path stabilityeditable for value-change vs selection-change partitioningdecorations for decoration propagation and redecorate behaviorchunking only if remaining core gaps justify chunk or index invalidation workreact-editor.spec.tsx and Playwright-style DOM focus coverage out unless a real Plate bug forces them in.table: prioritize transform-heavy and with* seams first, especially row or column mutations, selection helpers, merge or split behavior, and any remaining low-signal zero-coverage clusters.selection: keep it non-DOM where possible. Cover internal transforms, selection bookkeeping, copy or insert helpers, and hook behavior. Keep moveSelection and shiftSelection on Plate as the reviewed exception.markdown: deepen parser and serializer matrices, incomplete markdown and MDX boundaries, list edge cases, and explicit string assertions for readable outputs. Keep snapshots only where serialized structure is the contract.code-block, list-classic, autoformat, link: only add tests where real transform, parsing, or option behavior is still under-specified. Do not reopen packages that were already mostly cleanup work unless there is real logic left.media: prioritize placeholder grouping, validation, URL or file-type logic, and upload decision helpers. Keep React flows thin.docx-io and docx: keep package tests on pure converters and cleaners; keep app-owned roundtrip coverage in apps/www/src/__tests__/package-integration.ai: prioritize pure markdown or range helpers, chunk utilities, and serializer or deserializer boundaries. Avoid network or model fakery.dnd, combobox, suggestion, resizable, date, layout, list: only add tests where branches, transforms, or parser-like logic justify the cost.bun test remains the default workflow and must stay fast enough to not punish local use. Treat runtime growth as a constraint, not an afterthought.lcov or package-scoped coverage output over Bun’s broad summary.createEditor for pure Slate behaviorcreateSlateEditor for non-React plugin or editor wiringcreatePlateEditor only for reviewed Plate-specific boundariespnpm test:types must stay green, and phase 3 expands it materially for core. Phase 2 only adds type-tests if a utility contract proves worth the cost.testing.mdc is the single source of truth for durable testing policy.testing.mdc.../slate remains reference material, not a suite to mirror.