-
Couldn't load subscription status.
- Fork 664
Description
Version
1.0.0-beta.30
Reproduction link
https://github.com/motz-art/vue-test-utils-watcher-called-twice
Steps to reproduce
After opening repo run
npm i
npm run test:unit
What is expected?
After call to setProps component value watch handler should be called once.
This will match behavior of such component in a real browser.
And console output should be like that:
undefined
setting props
props are set.
good
As a result test will also pass.
What is actually happening?
After a call to setProps there is two calls to value watch handler, first with the value 'good' that is supplied in setProps and second with undefined.
See console output:
undefined
setting props
props are set.
good
undefined
As second call happens right before Promise is resolved, it sets delayedValue to undefined and that leads to failed test.
I don't know why but removing any of the if statements fixes the issue. As well as removing immediate: true from value watcher.
Checked this test in @vue/test-utils@1.0.0-beta.29 there is 3 calls to watch handler, so console output looks like:
undefined
setting props
props are set.
good
undefined
good