vitest
vitest copied to clipboard
Unable to use vitest fakeTimers alongside vue-i18n
Describe the bug
Hi there 👋🏻 ,
In one of my Vue 3 applications, I use vite & vitest for testing and I have a problem with one of my unit tests when I use fake timers and a component using vue-i18n.
I could not find the cause of my problem.
I'm not sure if the error comes from your library, but maybe from my code or from my test implementation. If this is the case I apologize in advance.
I also have created an issue in the intlify/vue-i18n-next repo.
Could you help me to solve this problem?
Reproduction
I've created a repo with multiple test cases:
- ✔️ simple component
- ✔️ simple component w/ fake timers
- ✔️ simple component w/ i18n
- ❌ simple component w/ i18n & fake timers
- ❌ simple component w/ i18n & fake timers w/o beforeEach & afterEach
Repro repository : smarlhens/vitejs-vite-i18n-fake-timers

System Info
System:
OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 8.43 GB / 31.08 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.15.0 - /usr/bin/node
Yarn: 1.22.15 - /usr/bin/yarn
npm: 8.5.5 - /usr/bin/npm
Browsers:
Chrome: 101.0.4951.54
Firefox: 99.0
npmPackages:
@intlify/vite-plugin-vue-i18n: 3.4.0 => 3.4.0
@vitejs/plugin-vue: 2.3.1 => 2.3.1
vite: 2.9.7 => 2.9.7
vitest: 0.10.0 => 0.10.0
vue: 3.2.33 => 3.2.33
vue-i18n: 9.2.0-beta.35 => 9.2.0-beta.35
vue-tsc: 0.34.11 => 0.34.11
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.