Repository navigation
[benchmarks] Chore: Migrate benchmarks to vitest 5 and add type checking in CI - #9235
Merged
Merged
Conversation
## Description
The Vitest upgrade removed the top-level bench export, leaving five benchmark
files untypeable and their runtime entry point unable to select a project.
Use the test-context bench fixture, explicit run/compare calls, and supported
benchmark lifecycle hooks. Preserve the paste benchmark's untimed per-iteration
reset and verification, and keep timing options on run(). Narrow the previous
sibling to ParagraphNode in the delete-range workload. Update the benchmark
script's project filter and the README examples for Vitest 5.
## Test plan
### Before
```text
$ node_modules/.bin/tsc --noEmit -p tsconfig.test.json
packages/lexical/src/__bench__/dom/editorCycle.bench.ts(10,9): error TS2724: '"vitest"' has no exported member named 'bench'. Did you mean 'Bench'?
packages/lexical/src/__bench__/dom/editorOperations.bench.ts(10,9): error TS2724: '"vitest"' has no exported member named 'bench'. Did you mean 'Bench'?
packages/lexical/src/__bench__/dom/editorOperations.bench.ts(136,15): error TS2740: Type 'LexicalNode' is missing the following properties from type 'ParagraphNode': extractWithChild, insertNewAfter, collapseAtStart, __first, and 57 more.
packages/lexical/src/__bench__/dom/editorOperations.bench.ts(221,16): error TS7006: Parameter 'task' implicitly has an 'any' type.
packages/lexical/src/__bench__/getWritable.bench.ts(9,9): error TS2724: '"vitest"' has no exported member named 'bench'. Did you mean 'Bench'?
packages/lexical/src/__bench__/nodeMap.bench.ts(9,9): error TS2724: '"vitest"' has no exported member named 'bench'. Did you mean 'Bench'?
packages/lexical/src/__bench__/serialization.bench.ts(10,9): error TS2724: '"vitest"' has no exported member named 'bench'. Did you mean 'Bench'?
```
### After
```text
$ node_modules/.bin/tsc --noEmit -p tsconfig.test.json
exit_code: 0 (no diagnostics)
$ npm run bench -- getWritable editorCycle editorOperations --reporter verbose
Test Files 3 passed (3)
Tests 32 passed (32)
$ node_modules/.bin/vitest bench --project 'bench*' --run nodeMap --testNamePattern '^size=100 :: clone$' --reporter verbose --pool=threads
Test Files 1 passed (1)
Tests 1 passed | 23 skipped (24)
```
ESLint, Prettier and git diff --check pass for the changed files.
The serialization benchmark's three cases also passed during a broader run;
the full node-map size/workload sweep was not completed.
## Description CI only ran the root TypeScript config, which excludes benchmarks. Add `tsc-test` for tsconfig.test.json and run it in `ci-check`, so the existing integrity job catches benchmark API/type regressions. Document this coverage. Also update the standalone production benchmark runner's Vitest shim for the test-context bench API introduced by the preceding commit. Await asynchronous case collection and map the new lifecycle hooks to the runner's setup and verification callbacks. ## Test plan ### Before ```text $ npm run tsc-test npm error Missing script: "tsc-test" $ LEXICAL_BENCH_FILTER='^$' LEXICAL_BENCH_SAMPLES=1 node scripts/bench-get-writable.mjs HEAD ERROR: No matching export in "benchmark:vitest" for import "test" ``` ### After ```text $ npm run tsc-test > @lexical/[email protected] tsc-test > tsc -p ./tsconfig.test.json exit_code: 0 (no diagnostics) $ npm run tsc-test -- --listFilesOnly # Verified compiler output includes all five benchmark files. $ node_modules/.bin/tsc -p tsconfig.scripts.json exit_code: 0 (no diagnostics) $ LEXICAL_BENCH_SAMPLES=1 node scripts/bench-get-writable.mjs HEAD^ exit_code: 0 # Validated JSON output: Production runner: all 12 workloads completed and verified for HEAD^ and WORKTREE. ``` Prettier, ESLint, and git diff --check pass for the changed files.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
marked this pull request as ready for review
September 25, 2026 16:03
etrepum
requested review from
acywatson,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
September 25, 2026 16:03
zurfyx
approved these changes
Sep 25, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The vitest 5 upgrade broke the benchmarks, but we don't run or test their types in CI. Agents would notice this and complain, but nothing was in the critical path so it went unfixed. This adds the types to CI so future breakage will get caught during the upgrade rather than after.
Closes #9194
Test plan
tsc now runs over the benchmarks during ci-check