Skip to content

fix: tolerate duplicate attachTo cleanup - #2830

Merged
danielroe merged 1 commit into
vuejs:mainfrom
cexbrayat:fix/attach-to-auto-unmount-cleanup
Apr 24, 2026
Merged

danielroe merged 1 commit into
vuejs:mainfrom
cexbrayat:fix/attach-to-auto-unmount-cleanup

Conversation

@cexbrayat

Copy link
Copy Markdown
Member

Regression introduced by #2700.

Without this guard, auto-unmounting a manually unmounted wrapper attached to document.body throws NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Regression introduced by vuejs#2700.

Without this guard, auto-unmounting a manually unmounted wrapper attached to document.body throws `NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.`
@netlify

netlify Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit 4c25c5d
🔍 Latest deploy log https://app.netlify.com/projects/vue-test-utils-docs/deploys/69eb5c9a9dea9b00085e7a7b
😎 Deploy Preview https://deploy-preview-2830--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Apr 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vue/test-utils@2830

commit: 4c25c5d

@cexbrayat
cexbrayat requested a review from danielroe April 24, 2026 12:18
@danielroe
danielroe merged commit 9a14e1a into vuejs:main Apr 24, 2026
8 checks passed
yeongsheng-tan added a commit to nerds-odd-e/doughnut that referenced this pull request Apr 24, 2026
…ssion

@vue/test-utils 2.4.7/2.4.8 added an `app.onUnmount(() => to.removeChild(el))`
callback (vuejs/test-utils#2700) that throws NotFoundError in two scenarios
that our suite relies on:

  - @testing-library/vue's render() calls `unwrapNode()` right after mount,
    detaching VTU's wrapper <div> from its parent before Vue's unmount hook
    runs -> every render()-based spec fails.
  - Double-unmount (manual wrapper.unmount() plus an afterEach fallback)
    re-fires the hook with el already detached.

Both surface as `[Vue warn]: Unhandled error during execution of app unmount
cleanup function`, which setupVitest intentionally rethrows, producing 216
failures across 25 spec files.

- Pin @vue/test-utils back to 2.4.6 in frontend/package.json.
- Add a TODO in frontend/tests/setupVitest.ts to re-bump once the upstream
  fix (vuejs/test-utils#2830) ships as 2.4.9.
- Harden FullScreen.spec.ts so its afterEach never double-unmounts, which
  keeps the test correct regardless of VTU version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants