Description
Describe the bug
Stubbing out Teleport in unit tests causes reactivity to behave unexpectedly. Specifically, the teleport component unmounts when its props are updated, but only when the Teleport is stubbed. This behavior differs from what is observed in the browser console, where the Child component stays mounted and reactivity works correctly.
To Reproduce
A minimal reproduction is available here: https://codesandbox.io/p/devbox/adoring-water-3pxr5p
Repro Steps
- Fork the project using the link above
- Open a new terminal
- Run pnpm test
Expected behavior
Both unit tests should pass, with reactivity working regardless of whether Teleport is stubbed or pointing to a real target.
Observed behaviour
Only the non-stubbed teleport test is passing.
Related information:
System:
OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (2) x64 AMD EPYC
Memory: 1.57 GB / 4.14 GB
Container: Yes
Shell: Unknown
npmPackages:
@vue/test-utils: 2.4.6 => 2.4.6
vitest: 3.0.8 => 3.0.8
vue: ^3.5.13 => 3.5.13
Additional context
Credits to @victor141516 for helping triaging this issue.