diff --git a/.github/workflows/fresh-install-tests.yml b/.github/workflows/fresh-install-tests.yml index 6596724f76..6d6ed4a452 100644 --- a/.github/workflows/fresh-install-tests.yml +++ b/.github/workflows/fresh-install-tests.yml @@ -11,9 +11,6 @@ name: Fresh Install Tests # so test tooling churn doesn't cause false positives. on: - push: - branches: - - package-upgrades schedule: - cron: "0 2 * * *" # Daily at 02:00 UTC workflow_dispatch: # Allow manual runs @@ -67,6 +64,19 @@ jobs: echo "Updating prod deps for: $FILTERS" eval pnpm update --prod $FILTERS + - id: dedupe_deps + name: Dedupe transitive dependencies + # After bumping the publishable packages' prod deps, collapse any + # duplicate transitive resolutions (e.g. @tiptap/core + @tiptap/pm) + # that would otherwise differ between the updated publishable packages + # and the un-updated examples/playground. Without this, TypeScript + # treats the two copies' exports as unrelated types and example-editor + # fails to build (TS2322 on Extension vs AnyExtension). + # Dedupe only rewrites the lockfile — it does NOT modify package.json, + # so the examples' "@blocknote/*": "latest" specs (which is what + # CodeSandbox users see) stay intact. + run: pnpm dedupe + - id: build_packages name: Build packages run: pnpm run build @@ -106,6 +116,8 @@ jobs: failed_step="Install dependencies" elif [ "${{ steps.update_prod_deps.outcome }}" = "failure" ]; then failed_step="Update prod deps of published packages" + elif [ "${{ steps.dedupe_deps.outcome }}" = "failure" ]; then + failed_step="Dedupe transitive dependencies" elif [ "${{ steps.build_packages.outcome }}" = "failure" ]; then failed_step="Build packages" elif [ "${{ steps.run_unit_tests.outcome }}" = "failure" ]; then diff --git a/packages/core/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts b/packages/core/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts index d10d4b08f1..433fa47806 100644 --- a/packages/core/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +++ b/packages/core/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts @@ -1,5 +1,5 @@ import { Selection } from "prosemirror-state"; -import { describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; @@ -9,9 +9,22 @@ import { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js"; const PLUGIN_KEY = "numbered-list-indexing-decorations$"; +// Track editors created in each test so we can unmount them in afterEach — +// otherwise prosemirror-view's DOMObserver leaves a setTimeout alive that +// fires after vitest tears down jsdom, throwing +// `ReferenceError: document is not defined` and failing the run. +const activeEditors: BlockNoteEditor[] = []; + +afterEach(() => { + while (activeEditors.length) { + activeEditors.pop()!.unmount(); + } +}); + function createEditor() { const editor = BlockNoteEditor.create(); editor.mount(document.createElement("div")); + activeEditors.push(editor); return editor; }