nuxt / test-utils

🧪 Test utilities for Nuxt
http://nuxt.com/docs/getting-started/testing
MIT License
313 stars 81 forks source link

error.vue can't be tested #769

Open martinsjek opened 7 months ago

martinsjek commented 7 months ago

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 commented 4 months ago

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

DariaYeremina commented 5 days ago

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" >