Skip to content

[scripts] Chore: Map the bare __tests__/utils alias to the index module only - #9482

Merged
etrepum merged 1 commit into
mainfrom
zurfyx/tsconfig-utils-alias
Oct 28, 2026
Merged

etrepum merged 1 commit into
mainfrom
zurfyx/tsconfig-utils-alias

Conversation

@zurfyx

@zurfyx zurfyx commented Oct 27, 2026

Copy link
Copy Markdown
Member

Description

update-tsconfig maps <pkg>/src/__tests__/utils to every file matching
src/__tests__/utils/*.{ts,tsx,mjs,jsx}, and Object.fromEntries keeps the
last one. packages/lexical/src/__tests__/utils now also holds
assertNodeType.ts and observedMutation.ts, so the alias depends on glob
order. On the release runner, update-packages (run by version.yml)
rewrote lexical/src/__tests__/utils in tsconfig.json and
tsconfig.test.json to assertNodeType.ts. The unit tests and the test
typecheck then could not find initializeUnitTest, createTestEditor and
the other helpers exported by index.tsx.

The script now matches only index.{ts,tsx,mjs,jsx}, which is what every
alias on main already points to. Regenerating restores index.tsx in both
files.

Test plan

Before

CI on the v0.53.0 release branch:

TypeError: initializeUnitTest is not a function
 Test Files  98 failed | 314 passed | 1 skipped (413)
      Tests  414 failed | 8676 passed | 4 expected fail | 1 skipped (9095)

packages/lexical/src/__tests__/unit/LexicalEditorEmptyState.test.ts(10,9): error TS2305: Module '"lexical/src/__tests__/utils"' has no exported member 'createTestEditor'.
ERROR: "tsc" exited with 2.

After

$ node scripts/update-tsconfig.mjs && git diff --stat origin/main -- tsconfig.json tsconfig.test.json packages/lexical-website/tsconfig.json
(no output: generated paths match main)

$ npx vitest --project unit --no-watch packages/lexical-mark/__tests__/unit/LexicalMarkNode.test.ts packages/lexical/src/__tests__/unit/CodeBlock.test.ts packages/lexical/src/__tests__/unit/HTMLCopyAndPaste.test.ts packages/lexical-playground/__tests__/unit/docSerialization.test.ts
 Test Files  4 passed (4)
      Tests  41 passed (41)

$ pnpm run tsc && pnpm run tsc-test
(both exit 0)

…le only

## Description

`update-tsconfig` maps `<pkg>/src/__tests__/utils` to every file matching
`src/__tests__/utils/*.{ts,tsx,mjs,jsx}`, and `Object.fromEntries` keeps the
last one. `packages/lexical/src/__tests__/utils` now also holds
`assertNodeType.ts` and `observedMutation.ts`, so the alias depends on glob
order. On the release runner, `update-packages` (run by `version.yml`)
rewrote `lexical/src/__tests__/utils` in `tsconfig.json` and
`tsconfig.test.json` to `assertNodeType.ts`. The unit tests and the test
typecheck then could not find `initializeUnitTest`, `createTestEditor` and
the other helpers exported by `index.tsx`.

The script now matches only `index.{ts,tsx,mjs,jsx}`, which is what every
alias on main already points to. Regenerating restores `index.tsx` in both
files.

## Test plan

### Before

CI on the v0.53.0 release branch:

```
TypeError: initializeUnitTest is not a function
 Test Files  98 failed | 314 passed | 1 skipped (413)
      Tests  414 failed | 8676 passed | 4 expected fail | 1 skipped (9095)

packages/lexical/src/__tests__/unit/LexicalEditorEmptyState.test.ts(10,9): error TS2305: Module '"lexical/src/__tests__/utils"' has no exported member 'createTestEditor'.
ERROR: "tsc" exited with 2.
```

### After

```
$ node scripts/update-tsconfig.mjs && git diff --stat origin/main -- tsconfig.json tsconfig.test.json packages/lexical-website/tsconfig.json
(no output: generated paths match main)

$ npx vitest --project unit --no-watch packages/lexical-mark/__tests__/unit/LexicalMarkNode.test.ts packages/lexical/src/__tests__/unit/CodeBlock.test.ts packages/lexical/src/__tests__/unit/HTMLCopyAndPaste.test.ts packages/lexical-playground/__tests__/unit/docSerialization.test.ts
 Test Files  4 passed (4)
      Tests  41 passed (41)

$ pnpm run tsc && pnpm run tsc-test
(both exit 0)
```
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 27, 2026 8:47pm UTC
lexical-playground Ready Ready Preview Oct 27, 2026 8:47pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
@zurfyx
zurfyx requested a review from etrepum as a code owner October 27, 2026 20:45
@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown
lexical

npm i https://pkg.pr.new/lexical@9482

@lexical/a11y

npm i https://pkg.pr.new/@lexical/a11y@9482

@lexical/clipboard

npm i https://pkg.pr.new/@lexical/clipboard@9482

@lexical/code

npm i https://pkg.pr.new/@lexical/code@9482

@lexical/code-core

npm i https://pkg.pr.new/@lexical/code-core@9482

@lexical/code-prism

npm i https://pkg.pr.new/@lexical/code-prism@9482

@lexical/code-shiki

npm i https://pkg.pr.new/@lexical/code-shiki@9482

@lexical/compiler

npm i https://pkg.pr.new/@lexical/compiler@9482

@lexical/devtools-core

npm i https://pkg.pr.new/@lexical/devtools-core@9482

@lexical/dragon

npm i https://pkg.pr.new/@lexical/dragon@9482

@lexical/eslint-plugin

npm i https://pkg.pr.new/@lexical/eslint-plugin@9482

@lexical/extension

npm i https://pkg.pr.new/@lexical/extension@9482

@lexical/fast-check

npm i https://pkg.pr.new/@lexical/fast-check@9482

@lexical/file

npm i https://pkg.pr.new/@lexical/file@9482

@lexical/hashtag

npm i https://pkg.pr.new/@lexical/hashtag@9482

@lexical/headless

npm i https://pkg.pr.new/@lexical/headless@9482

@lexical/history

npm i https://pkg.pr.new/@lexical/history@9482

@lexical/html

npm i https://pkg.pr.new/@lexical/html@9482

@lexical/internal

npm i https://pkg.pr.new/@lexical/internal@9482

@lexical/link

npm i https://pkg.pr.new/@lexical/link@9482

@lexical/list

npm i https://pkg.pr.new/@lexical/list@9482

@lexical/mark

npm i https://pkg.pr.new/@lexical/mark@9482

@lexical/markdown

npm i https://pkg.pr.new/@lexical/markdown@9482

@lexical/mdast

npm i https://pkg.pr.new/@lexical/mdast@9482

@lexical/offset

npm i https://pkg.pr.new/@lexical/offset@9482

@lexical/overflow

npm i https://pkg.pr.new/@lexical/overflow@9482

@lexical/plain-text

npm i https://pkg.pr.new/@lexical/plain-text@9482

@lexical/react

npm i https://pkg.pr.new/@lexical/react@9482

@lexical/rich-text

npm i https://pkg.pr.new/@lexical/rich-text@9482

@lexical/selection

npm i https://pkg.pr.new/@lexical/selection@9482

@lexical/table

npm i https://pkg.pr.new/@lexical/table@9482

@lexical/tailwind

npm i https://pkg.pr.new/@lexical/tailwind@9482

@lexical/text

npm i https://pkg.pr.new/@lexical/text@9482

@lexical/utils

npm i https://pkg.pr.new/@lexical/utils@9482

@lexical/yjs

npm i https://pkg.pr.new/@lexical/yjs@9482

commit: f21a605

@etrepum
etrepum added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 5bc4f4b Oct 28, 2026
54 checks passed
potatowagon added a commit to potatowagon/lexical that referenced this pull request Oct 28, 2026
Conflict in `scripts/update-tsconfig.mjs`: meta#9482 landed the same index-only
fix for the bare `<pkg>/src/__tests__/utils` alias on main, so this takes
main's version and drops the one from 836aff9.
@zurfyx zurfyx mentioned this pull request Oct 28, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — f21a6055 Deployed Oct 27, 2026 by vercel[bot]
Preview – lexical-playground — f21a6055 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants