Skip to content

Commit 64a9c1f

Browse files
authored
docs: note Vue's dependence on system time (#2100)
1 parent 4e5572a commit 64a9c1f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/api/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar: auto
77
## mount
88

99
Creates a Wrapper that contains the mounted and rendered Vue component to test.
10+
Note that when mocking dates/timers with Vitest, this must be called after
11+
`vi.setSystemTime`.
1012

1113
**Signature:**
1214

docs/guide/faq/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
[[toc]]
44

5+
## Mocking Dates and Timers with Vitest
6+
7+
Vue's scheduler depends on the system time. Make sure to mount components
8+
*after* calling `vi.setSystemTime`, since Vue depends on its side effects.
9+
Mounting components before calling `vi.setSystemTime` may cause breaks in
10+
reactivity.
11+
12+
See [vuejs/test-utils#2074](https://github.com/vuejs/test-utils/issues/2074).
13+
514
## Vue warn: Failed setting prop
615

716
```

0 commit comments

Comments
 (0)