From bb88b452d5bc61517f92b431a0824b3506ae9c86 Mon Sep 17 00:00:00 2001 From: Wei Hung Date: Sun, 27 Sep 2026 16:18:14 +0800 Subject: [PATCH] fix: classify vitest.config.ts as non-deploy and finish parsing before live math assertions --- apps/web/src/components/live-markdown/math.test.ts | 5 +++++ scripts/vercel-sparse-non-deploy-paths.mjs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/live-markdown/math.test.ts b/apps/web/src/components/live-markdown/math.test.ts index 82bb0bfd..65ac7563 100644 --- a/apps/web/src/components/live-markdown/math.test.ts +++ b/apps/web/src/components/live-markdown/math.test.ts @@ -3,6 +3,7 @@ import { afterEach, describe, expect, it } from 'vitest'; import { EditorState, StateField } from '@codemirror/state'; import { Decoration, type DecorationSet, EditorView } from '@codemirror/view'; import { markdown, markdownLanguage } from '@codemirror/lang-markdown'; +import { ensureSyntaxTree } from '@codemirror/language'; import { cjkEmphasis } from './cjk-emphasis.js'; import { chipEditState } from './chip-editing.js'; import { tableUIState } from '../LiveMarkdownTable.js'; @@ -17,6 +18,10 @@ const views: EditorView[] = []; function editor(doc: string, cursor = doc.length) { const view = new EditorView({ parent: document.body, state: EditorState.create({ doc, selection: { anchor: cursor }, extensions: [markdown({ base: markdownLanguage, extensions: [cjkEmphasis] }), chipEditState, tableUIState, decorations] }) }); views.push(view); + // The first parse runs on a time budget, so under load a code block late in the note can still be unparsed; + // finish the parse and let the decorations recompute, as the editor does once its parser catches up. + ensureSyntaxTree(view.state, view.state.doc.length, 5000); + view.dispatch({}); return view; } afterEach(() => { diff --git a/scripts/vercel-sparse-non-deploy-paths.mjs b/scripts/vercel-sparse-non-deploy-paths.mjs index ee31eaa9..dc9130b2 100644 --- a/scripts/vercel-sparse-non-deploy-paths.mjs +++ b/scripts/vercel-sparse-non-deploy-paths.mjs @@ -1,2 +1,2 @@ // Tracked top-level Core paths that the Vercel build and runtime do not need. -export const nonDeployPaths = ['.claude', '.codex', '.dockerignore', '.env.example', '.git-blame-ignore-revs', '.github', '.gitignore', '.oxlintrc.json', 'Dockerfile', 'README.md', 'README.zh-TW.md', 'compose.local.yaml', 'compose.yaml', 'docker.env.example', 'docs', 'dprint.json', 'examples', 'scripts']; +export const nonDeployPaths = ['.claude', '.codex', '.dockerignore', '.env.example', '.git-blame-ignore-revs', '.github', '.gitignore', '.oxlintrc.json', 'Dockerfile', 'README.md', 'README.zh-TW.md', 'compose.local.yaml', 'compose.yaml', 'docker.env.example', 'docs', 'dprint.json', 'examples', 'scripts', 'vitest.config.ts'];