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

error.vue can't be tested #769

Closed
martinsjek opened this issue Feb 27, 2024 · 5 comments
Closed

error.vue can't be tested #769

martinsjek opened this issue Feb 27, 2024 · 5 comments

Comments

@martinsjek
Copy link

Environment

StackBlitz

Reproduction

https://stackblitz.com/edit/github-vy6psx-sn3lfr?file=.nuxtignore,error.vue,__tests__%2Ferror.spec.ts

Describe the bug

I get this error:
[Vue Router warn]: No match found for location with path "/123" [Vue warn]: Cannot mutate <script setup> binding "error" from Options API. at <MountSuspendedComponent error= { url: '/123', statusCode: 404, statusMessage: 'Not Found', message: 'Error', description: '' } > at <MountSuspendedHelper> at <Anonymous ref="VTU_COMPONENT" > at <VTUROOT> [Vue warn]: Unhandled error during execution of render function at <MountSuspendedComponent error= { url: '/123', statusCode: 404, statusMessage: 'Not Found', message: 'Error', description: '' } > at <MountSuspendedHelper> at <Anonymous ref="VTU_COMPONENT" > at <VTUROOT>

Additional context

You can get this error running: npm run test ./tests/error.spec.ts

Logs

No response

@vhovorun
Copy link

vhovorun commented May 7, 2024

Same issue, reproduces when you have useError composable inside of your component, without it test passes

@DariaYeremina
Copy link

DariaYeremina commented Sep 24, 2024

Got the same error trying to test overwritten ProseImg component.

[Vue warn]: Cannot mutate <script setup> binding "url" from Options API. 
  at <RenderSuspendedComponent url="https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg" > 

@strokirk
Copy link

Same as #684 ?

@IT-WIBRC
Copy link

Environment

StackBlitz

Reproduction

https://stackblitz.com/edit/github-vy6psx-sn3lfr?file=.nuxtignore,error.vue,__tests__%2Ferror.spec.ts

Describe the bug

I get this error: [Vue Router warn]: No match found for location with path "/123" [Vue warn]: Cannot mutate <script setup> binding "error" from Options API. at <MountSuspendedComponent error= { url: '/123', statusCode: 404, statusMessage: 'Not Found', message: 'Error', description: '' } > at <MountSuspendedHelper> at <Anonymous ref="VTU_COMPONENT" > at <VTUROOT> [Vue warn]: Unhandled error during execution of render function at <MountSuspendedComponent error= { url: '/123', statusCode: 404, statusMessage: 'Not Found', message: 'Error', description: '' } > at <MountSuspendedHelper> at <Anonymous ref="VTU_COMPONENT" > at <VTUROOT>

Additional context

You can get this error running: npm run test ./tests/error.spec.ts

Logs

No response

I got the same error with a props name error in my component when I tested using mountSuspended from @nuxt/test-utils/runtime. To resolve it, I have just changed it to errorMessage. Maybe the test engine has a constraint with the name error .

I suggest changing the name error to a context name like 404.vue.

@danielroe
Copy link
Member

This should now be resolved in #1025.

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

No branches or pull requests

6 participants