Vue-test-utils: mount fails on second attempt

Created on 28 Nov 2019  路  4Comments  路  Source: vuejs/vue-test-utils

Version

1.0.0-beta.29

Reproduction link

https://github.com/relief-melone/rm-test-mount-fails-on-second-exec.git

Steps to reproduce

  1. Clone Repository
  2. npm install
  3. npm run test:unit

What is expected?

Four tests have been written each just wrapping a component utilizing Vuetify and mounting it.

As all tests are exactly the same it is expected for them all to succeed and behave in the same way.

What is actually happening?

mount is failing on the second execution reproducible producing the error

TypeError: Cannot read property '$scopedSlots' of undefined

Test Executions 1,3 and 4 behave as expected


I cannot be 100% sure if this issue is caused by Vuetify or the Test Utils. I have been trying alot of different configurations of using localVue Vuetify or vuetify created from new Vuetify but had no luck. There is also a thread open on StackOverflow.
(https://stackoverflow.com/questions/59070770/testing-vuetify-vue-js-second-call-on-mount-throws-error)

Another user mentioned he did not get the wrong behaviour on version 1.5.21

Versions:

Vue: 2.6.10
Vue-Test-Utils: 1.0.0-beta.29
Vuetify: 2.1.12

All 4 comments

Not exactly the same but I guess the root cause is the same as stated in #1130. In any case the workaround setting sync to false works. In my opinion this is still a serious bug as identical tests should always have the same outcome but at least there is a way to work with it. If anybody is struggeling with this as I did use

const wrapper = mount(BugExample, {
  localVue,
  vuetify,
  propsData: { value: [] },
  sync: false
});

Does this still occur in v30? (Sync mode removed in v30)

This is fixed in v30. I checked out the reproduction repo. I was able to reproduce the failure in v29 and then when I upgrade to v30, everything works fine.
@relief-melone I'm going to close this issue. Please reopen if upgrading with npm i -D @vue/[email protected] does not solve your issue.

Hey,

sorry for the late reply. I can confirm that this fixed the error. Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings