Skip to content

mountSuspended with script setup throws mutation warning #1370

@SokolovskyiAnton

Description

@SokolovskyiAnton

Environment

  • Operating System: Linux
  • Node Version: v22.14.0
  • CLI Version: 3.27.0
  • Nitro Version: 2.12.4
  • Package Manager: npm@11.4.1
  • nuxt Version: 4.0.2
  • @nuxt/test-utils: ^3.19.2
  • vitest: ^3.2.4
  • @vue/test-utils: ^2.4.6
  • vue: ^3.5.17

Reproduction

<script setup lang="ts">
const { error = false } = defineProps<{ error?: boolean }>()
</script>

### Describe the bug

When testing Nuxt components written using `<script setup>` and destructured `defineProps()`, calling `wrapper.setProps(...)` causes a Vue runtime warning and the test fails.


### Additional context

_No response_

### Logs

```shell-script
[Vue warn]: Cannot mutate <script setup> binding "error" from Options API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions