Description
Subject of the issue
Hi,
this issue is created, after another issue was opened here in vue-testing-library
: testing-library/vue-testing-library#275
The core of the problem seems to be in @vue/test-utils
:
When using the compat mode or the 2.7 build, the unit tests start failing when using the composition api in the SFC syntax.
I tried using the composition api in a SFC synctax from the 2.7 build itself and this behaviour appears:
<script setup>
import { ref, onBeforeMount, defineProps } from 'vue'
defineProps({
msg: {
type: String,
default: ''
},
})
const label = ref('init')
onBeforeMount(() => {
label.value = 'mounted'
})
</script>
<template>
<div>{{ msg }} - {{ label }}</div>
</template>
results in this testing html
If we use the regular export default
syntax with the composition api, it seems to be still working.
Steps to reproduce
To reproduce the behavior:
Use this minimal reproduction repo: https://github.com/lisilinhart/vue-2.7-sfc-test-bug-repo
Expected behaviour
When mounting the component with the composition API in a sfc syntax, it should render the component correctly like it does for the options api.
Actual behaviour
The asynchronous text is never rendered in the mounted component.