Description
Before this library is ready for 1.0.0 we need to fix the synchronous behavior.
Context
By default Vue performs DOM updates asynchronously. When we created this library, we decided to make it perform updates synchronously, to improve the readability of tests.
The original way that we implemented synchronous DOM updates was by running the instance render watcher when wrapper method, like trigger
or setProps
changed instance properties.
There were two issues with that approach. First, if you made a change that occurred outside of Vue Test Utils, you would need to call an update
function that ran watchers.
Second, there were bugs that were difficult to solve, such as watchers running when they should not.
In beta.12 we changed the approach by setting all watchers as synchronous. This approach has caused a number of bugs because watchers cannot complete the full lifecycle. Some of these bugs are very difficult to fix.
Solution
I've submitted a PR to Vue core that will allow us to set tests to run synchronously. This will fix all the current bugs with synchronous.
Problem
The problem is that this change will only be available in Vue > 2.6. This library supports all Vue 2.x versions, so we need to make a decision:
Do we continue with the current buggy synchronous behavior, or remove synchronous behavior for Vue < 2.6 and encourage users to use Vue.nextTick
/ setTimeout
to run tests?
What do people think?