Skip to content

fix: remove wrapper div when unmount - #2700

Merged
cexbrayat merged 2 commits into
vuejs:mainfrom
CaptainWang98:fix_#2690
Aug 12, 2025
Merged

cexbrayat merged 2 commits into
vuejs:mainfrom
CaptainWang98:fix_#2690

Conversation

@CaptainWang98

Copy link
Copy Markdown
Contributor

Fix #2690
Regist a onUnmount to remove the wapper when append the wapper div to target DOM.

@netlify

netlify Bot commented Aug 12, 2025 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 5d3e197
🔍 Latest deploy log https://app.netlify.com/projects/vue-test-utils-docs/deploys/689affa4ddf18b00088bc5a0
😎 Deploy Preview https://deploy-preview-2700--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.

@cexbrayat

Copy link
Copy Markdown
Member

@CaptainWang98 Thanks for the PR 👍

Can you take care of the linting issues please?

@cexbrayat
cexbrayat merged commit 4dcea9e into vuejs:main Aug 12, 2025
@CaptainWang98
CaptainWang98 deleted the fix_#2690 branch August 13, 2025 02:40
cexbrayat added a commit to cexbrayat/test-utils that referenced this pull request Apr 24, 2026
cexbrayat added a commit to cexbrayat/test-utils that referenced this pull request Apr 24, 2026
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.`
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.

Bug: <div> wrapper not cleaned up on unmount

2 participants