-
Notifications
You must be signed in to change notification settings - Fork 89
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
Computed Properties Not Updating in Tests When Using mountSuspended #1115
Labels
Comments
|
Apologies, but after reflecting on it, I think it's best to report this here - https://github.com/nuxt/test-utils/issues. Right? |
+1 |
I have the same problem. |
I have the same problem too, I can't test the behaviour of computed properties using |
+1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Reproduction
Minimal Reproduction - https://stackblitz.com/edit/github-remjha3q?file=app.vue
app.vue
andapp.spec.ts
filesnpm run rest
Describe the bug
When testing a Vue component using
mountSuspended
from@nuxt/test-utils/runtime
, computed properties fail to update reactively when their dependencies change. The same test cases pass when using@vue/test-utils
'mount
orshallowMount
methods.Current Behavior:
foo
updates correctlybar
remains stale with its initial valuebaz
remains stale with its initial valueExpected Behavior:
foo
changes totrue
:foo
property should updatebar
should update to"(bar = true)"
baz
should update to"baz => (bar = true)"
Workaround:
Using standard
@vue/test-utils
mounting methods works as expected:Files
package.json
vitest.config.ts
app.vue
app.spec.ts
Additional context
Pre-setting initial data values through the mount options also doesn't work with
mountSuspended
, while it works fine with other mounting methods.Logs
The text was updated successfully, but these errors were encountered: