Skip to content

fix: only apply stubs to the app being rendered - #2997

Merged
cexbrayat merged 1 commit into
vuejs:mainfrom
ValentinYoushkevich:fix/stubs-per-app
Nov 6, 2026
Merged

cexbrayat merged 1 commit into
vuejs:mainfrom
ValentinYoushkevich:fix/stubs-per-app

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

mount, shallowMount and renderToString install their stubs with Vue's global transformVNodeArgs and never remove them, so any other app rendered later in the same file still gets stubbed, even after unmount():

shallowMount(Loading).unmount()

const el = document.createElement('div')
createApp({ render: () => h(Loading) }).mount(el)
el.innerHTML // '<b-loading-stub></b-loading-stub>'

The same happens with createSSRApp + @vue/server-renderer (<transition-stub> in the server HTML, hydration mismatch), and a wrapper mounted earlier re-renders with the stubs of the last mounted one. Repro: playground (2.5.1), playground (main)

The transformer of each app is now stored in a WeakMap keyed by the app, and a single dispatcher installed with transformVNodeArgs applies the one of the app being rendered (vnodes created outside of any component still use the last mounted wrapper's transformer). Since every transformer now only sees its own app, the mountedRootComponents set from #2890 is no longer needed and is removed (the #2675 test still passes). Note that components rendered by another app, e.g. one created with createApp inside a component, are no longer stubbed.

Projects working around this in their tests:

@netlify

netlify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 1f6326c
🔍 Latest deploy log https://app.netlify.com/projects/vue-test-utils-docs/deploys/6aed70e8ed81ece0ca10c294
😎 Deploy Preview https://deploy-preview-2997--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 Oct 31, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 1f6326c

@cexbrayat cexbrayat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@cexbrayat

Copy link
Copy Markdown
Member

@ValentinYoushkevich would you mind rebasing the branch please? I'll merge when done

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor Author

Done

@cexbrayat
cexbrayat merged commit 63cd4a9 into vuejs:main Nov 6, 2026
9 checks passed
raddatzk added a commit to raddatzk/veyq that referenced this pull request Nov 22, 2026
@vue/test-utils 2.6.0 applies a mount's `stubs` to that app alone
(vuejs/test-utils#2997). The "Not you?" case relied on the old leak: the
confirmation dialog mounted beside the page unstubbed the page's VeyqDialog,
so the name prompt teleported into document.body. Now it renders in place as
the stub, like the sibling cases read it, and the body assertion saw ''.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
raddatzk added a commit to raddatzk/veyq that referenced this pull request Nov 22, 2026
…4 updates (#38)

* chore(deps): bump the npm-minor-patch group across 1 directory with 14 updates

Bumps the npm-minor-patch group with 14 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [eslint](https://github.com/eslint/eslint) | `10.14.0` | `10.15.0` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.72.1` | `8.73.0` |
| [@lucide/vue](https://github.com/lucide-icons/lucide/tree/HEAD/packages/vue) | `1.68.0` | `1.74.0` |
| [vue](https://github.com/vuejs/core) | `3.5.44` | `3.5.45` |
| [vue-i18n](https://github.com/intlify/vue-i18n/tree/HEAD/packages/vue-i18n) | `11.4.18` | `11.4.22` |
| [vue-router](https://github.com/vuejs/router) | `5.4.0` | `5.5.1` |
| [@intlify/message-compiler](https://github.com/intlify/vue-i18n/tree/HEAD/packages/message-compiler) | `11.4.18` | `11.4.22` |
| [@openapitools/openapi-generator-cli](https://github.com/OpenAPITools/openapi-generator-cli) | `2.42.0` | `2.42.2` |
| [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue) | `6.0.10` | `6.0.11` |
| [@vue/test-utils](https://github.com/vuejs/test-utils) | `2.5.1` | `2.6.0` |
| [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) | `10.12.0` | `10.12.1` |
| [fake-indexeddb](https://github.com/dumbmatter/fakeIndexedDB) | `6.2.7` | `6.2.8` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `8.3.5` | `8.3.8` |
| [vue-eslint-parser](https://github.com/vuejs/vue-eslint-parser) | `10.4.1` | `10.4.2` |



Updates `eslint` from 10.14.0 to 10.15.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](eslint/eslint@v10.14.0...v10.15.0)

Updates `typescript-eslint` from 8.72.1 to 8.73.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.73.0/packages/typescript-eslint)

Updates `@lucide/vue` from 1.68.0 to 1.74.0
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.74.0/packages/vue)

Updates `vue` from 3.5.44 to 3.5.45
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](vuejs/core@v3.5.44...v3.5.45)

Updates `vue-i18n` from 11.4.18 to 11.4.22
- [Release notes](https://github.com/intlify/vue-i18n/releases)
- [Changelog](https://github.com/intlify/vue-i18n/blob/v11.4.22/CHANGELOG.md)
- [Commits](https://github.com/intlify/vue-i18n/commits/v11.4.22/packages/vue-i18n)

Updates `vue-router` from 5.4.0 to 5.5.1
- [Release notes](https://github.com/vuejs/router/releases)
- [Commits](vuejs/router@v5.4.0...v5.5.1)

Updates `@intlify/message-compiler` from 11.4.18 to 11.4.22
- [Release notes](https://github.com/intlify/vue-i18n/releases)
- [Changelog](https://github.com/intlify/vue-i18n/blob/v11.4.22/CHANGELOG.md)
- [Commits](https://github.com/intlify/vue-i18n/commits/v11.4.22/packages/message-compiler)

Updates `@openapitools/openapi-generator-cli` from 2.42.0 to 2.42.2
- [Release notes](https://github.com/OpenAPITools/openapi-generator-cli/releases)
- [Commits](OpenAPITools/openapi-generator-cli@v2.42.0...v2.42.2)

Updates `@vitejs/plugin-vue` from 6.0.10 to 6.0.11
- [Release notes](https://github.com/vitejs/vite-plugin-vue/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-vue/commits/[email protected]/packages/plugin-vue)

Updates `@vue/test-utils` from 2.5.1 to 2.6.0
- [Release notes](https://github.com/vuejs/test-utils/releases)
- [Commits](vuejs/test-utils@v2.5.1...v2.6.0)

Updates `eslint-plugin-vue` from 10.12.0 to 10.12.1
- [Release notes](https://github.com/vuejs/eslint-plugin-vue/releases)
- [Changelog](https://github.com/vuejs/eslint-plugin-vue/blob/master/CHANGELOG.md)
- [Commits](vuejs/eslint-plugin-vue@v10.12.0...v10.12.1)

Updates `fake-indexeddb` from 6.2.7 to 6.2.8
- [Release notes](https://github.com/dumbmatter/fakeIndexedDB/releases)
- [Changelog](https://github.com/dumbmatter/fakeIndexedDB/blob/master/CHANGELOG.md)
- [Commits](dumbmatter/fakeIndexedDB@v6.2.7...v6.2.8)

Updates `vite` from 8.3.5 to 8.3.8
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.3.8/packages/vite)

Updates `vue-eslint-parser` from 10.4.1 to 10.4.2
- [Release notes](https://github.com/vuejs/vue-eslint-parser/releases)
- [Commits](vuejs/vue-eslint-parser@v10.4.1...v10.4.2)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 10.15.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: typescript-eslint
  dependency-version: 8.73.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: "@lucide/vue"
  dependency-version: 1.74.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: vue
  dependency-version: 3.5.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: vue-i18n
  dependency-version: 11.4.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: vue-router
  dependency-version: 5.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: "@intlify/message-compiler"
  dependency-version: 11.4.22
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@openapitools/openapi-generator-cli"
  dependency-version: 2.42.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@vitejs/plugin-vue"
  dependency-version: 6.0.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@vue/test-utils"
  dependency-version: 2.6.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: eslint-plugin-vue
  dependency-version: 10.12.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: fake-indexeddb
  dependency-version: 6.2.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: vite
  dependency-version: 8.3.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: vue-eslint-parser
  dependency-version: 10.4.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* test(web): read the re-asked name where test-utils 2.6 draws it

@vue/test-utils 2.6.0 applies a mount's `stubs` to that app alone
(vuejs/test-utils#2997). The "Not you?" case relied on the old leak: the
confirmation dialog mounted beside the page unstubbed the page's VeyqDialog,
so the name prompt teleported into document.body. Now it renders in place as
the stub, like the sibling cases read it, and the body assertion saw ''.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kevin Raddatz <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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