Skip to content

Bug: Reactivity breaks when Teleport is stubbed in unit tests, causing unexpected unmounts on teleported components #2628

Open
@Alevagre7

Description

@Alevagre7

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

  1. Fork the project using the link above
  2. Open a new terminal
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions