Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Using @vue/test-utils in sync mode leads to test failures #159

Closed
kierans opened this issue Feb 12, 2020 · 3 comments
Closed

Comments

@kierans
Copy link

kierans commented Feb 12, 2020

Environment

Vuetify Version: 2.2.12
Vue Version: 2.6.10

Steps to reproduce

  1. Create a new project via Vue CLI
  2. Ensure that the version of @vue/test-utils < 1.0.0-beta.30
  3. Write a set of unit tests that exercise form validation

Expected behaviour

npm run test:unit runs successfully.

Actual behaviour

npm run test:unit tests will fail with TypeError: Cannot read property '$scopedSlots' of undefined error message.

@kierans
Copy link
Author

kierans commented Feb 12, 2020

As outlined in vuejs/vue-test-utils#1137 the reason is due to @vue/test-utils running in sync mode which doesn't work well with how Vue updates the DOM in a batch.

When adding Vuetify to a project via the CLI, I suggest that any entry of @vue/test-utils be upgraded to >= 1.0.0-beta.30 so that sync mode is no longer present. This will have the consequence of forcing unit tests to await DOM updates.

@KaelWD
Copy link
Member

KaelWD commented Feb 13, 2020

Duplicate of vuetifyjs/vuetify#9151

I suggest that any entry of @vue/test-utils be upgraded to >= 1.0.0-beta.30

This would break any existing tests, the upgrade should be done manually if needed.

@kierans
Copy link
Author

kierans commented Feb 13, 2020

This would break any existing tests, the upgrade should be done manually if needed.

But it is likely that tests (at least those using mount) will break anyway because sync mode doesn't work well with Vuetify.

The plugin could output a warning message, or ask the user if they want to upgrade @vue/test-utils.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants