Description
Describe the bug
I am encountering an issue where a behavior that works correctly in the browser does not work in a unit test using Vitest and Vue Test Utils. I am not sure if this is a bug or if I am missing something, but I could not find any relevant information in the documentation.
I created a minimal reproduction to illustrate the issue. Despite spending a lot of time investigating, I haven't been able to determine what I am doing wrong.
To Reproduce
A minimal reproduction is available here: https://stackblitz.com/edit/vitejs-vite-fwbsiysg
⚠ Note: The test command does not run in StackBlitz. To reproduce the issue, please:
- Download the project
- Run
npm install
- Run
npm run test:unit
Expected behavior
The unit test should produce the same behavior observed when running the application in the browser.
Related information:
System:
OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1355U
Memory: 6.57 GB / 15.25 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
npmPackages:
@vue/test-utils: ^2.4.6 => 2.4.6
vitest: ^3.0.8 => 3.0.8
vue: ^3.5.13 => 3.5.13
I would greatly appreciate any insights or pointers. Thanks in advance!