You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is one of the environments i came across the problem:
[11:15:23 AM] Working directory: /Users/lorenzorottigni/Documents/gitlab_private/portfolio.rottigni.tech
[11:15:23 AM] Nuxt project info: (copied to clipboard)
I'm currently facing challenges in testing a component method within a Nuxt environment. Specifically, I'm attempting to spy on a component method to test its interactions within template events. Despite researching similar cases online, I've yet to find a clear solution to this issue.
One suggestion I encountered was to define the spy before the component mounts. However, I'm unable to access wrapper.vm before mount time, complicating this approach. Additionally, I experimented with spying on the global injected $fetch method from the 'ofetch' library. Unfortunately, this led to another error regarding the inability to redefine the variable $fetch when attempting variations like:
It appears that this issue may not be directly tied to the nuxt-test-utils package. Nevertheless, I wanted to bring it to your attention in the hopes that someone might offer guidance or assistance. I'm eager to find a resolution and would appreciate any insights or suggestions you might have.
I'm also considering reporting a similar issue to the vue-test-utils package, as I suspect that this problem might be reproducible outside of the Nuxt environment.
Thank you for your time and assistance.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
Bumping this as it seems to have been complete forgotten but is still and issue. Just like the OP I have found no working way to actually ,spy on user defined component methods...
Environment
This is one of the environments i came across the problem:
[11:15:23 AM] Working directory: /Users/lorenzorottigni/Documents/gitlab_private/portfolio.rottigni.tech
[11:15:23 AM] Nuxt project info: (copied to clipboard)
[11:15:23 AM] 👉 Report an issue: https://github.com/nuxt/nuxt/issues/new
👉 Suggest an improvement: https://github.com/nuxt/nuxt/discussions/new
👉 Read documentation: https://nuxt.com
Reproduction
The crucial file is MyComponent.spec.ts:
https://stackblitz.com/~/github.com/LorenzoRottigni/nuxt-test-utils-vitest-spy
Describe the bug
I'm currently facing challenges in testing a component method within a Nuxt environment. Specifically, I'm attempting to spy on a component method to test its interactions within template events. Despite researching similar cases online, I've yet to find a clear solution to this issue.
One suggestion I encountered was to define the spy before the component mounts. However, I'm unable to access
wrapper.vm
before mount time, complicating this approach. Additionally, I experimented with spying on the global injected$fetch
method from the 'ofetch' library. Unfortunately, this led to another error regarding the inability to redefine the variable$fetch
when attempting variations like:It appears that this issue may not be directly tied to the nuxt-test-utils package. Nevertheless, I wanted to bring it to your attention in the hopes that someone might offer guidance or assistance. I'm eager to find a resolution and would appreciate any insights or suggestions you might have.
I'm also considering reporting a similar issue to the vue-test-utils package, as I suspect that this problem might be reproducible outside of the Nuxt environment.
Thank you for your time and assistance.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: