Skip to content

Commit

Permalink
docs: note Vue's dependence on system time (#2100)
Browse files Browse the repository at this point in the history
  • Loading branch information
aentwist authored Jun 20, 2023
1 parent 4e5572a commit 64a9c1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ sidebar: auto
## mount

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

**Signature:**

Expand Down
9 changes: 9 additions & 0 deletions docs/guide/faq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

[[toc]]

## Mocking Dates and Timers with Vitest

Vue's scheduler depends on the system time. Make sure to mount components
*after* calling `vi.setSystemTime`, since Vue depends on its side effects.
Mounting components before calling `vi.setSystemTime` may cause breaks in
reactivity.

See [vuejs/test-utils#2074](https://github.com/vuejs/test-utils/issues/2074).

## Vue warn: Failed setting prop

```
Expand Down

0 comments on commit 64a9c1f

Please sign in to comment.