-
Notifications
You must be signed in to change notification settings - Fork 668
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
template fails to re-render when ref value is changed under test when using [email protected] #1982
Comments
elements using |
likely related #1983 |
I don't think so. Their issue is related to |
Could be a bit of both. Likely both Vue Jest and Test Utils need patching. |
I believe this is a case of the dual package hazard that has already caused issues at other places (see e.g. vuejs/vue#12626). Essentially, the vite plugin for vue2 aliases vue imports to the ESM file ( Unfortunately I'm not sure what the "proper" workaround for that is; I could see the root issue being with the vite plugin, the way VTU imports Vue, or even with the exports declaration from the vue package. Maybe someone else has a better understanding there. What does work as a temporary fix though is to override the resolve alias defined through the vite plugin in your test config:
While there's good reason to use the ESM build in production, that should be fine for the test execution. |
@dneuschaefer-rube All tests pass. Thanks!! |
I looked into this here vuejs/test-utils#1665 (comment) I think there might be a bug in Vitest around resolving the correct module for Vue compat. I don't know if it's related to the issue here, but this info might help people from from Google with a Vitest/Test Utils/compat issue. |
Subject of the issue
template fails to re-render when ref value is changed under test when using [email protected]
template does update with user interaction in browser.
elements using
v-if
directive fail to re-render when predicate value changes during unit testing.Steps to reproduce
https://codesandbox.io/s/fervent-tdd-fijnxf
run
npm run test
Expected behaviour
template is re-rendered and relevant elements found using
wrapper.find
/wrapper.findAll
Actual behaviour
no change in template
Possible Solution
?
much appreciated!
The text was updated successfully, but these errors were encountered: