1 year ago
#280734
user1199514
jest does not collect coverage for vue file in case it just have defineProps and defineEmit in scripts
i am not sure why Jest coverage behavior changes in below scenario
it does not collect a coverage if i have code like below.
<template>
<Teleport to="body">
<div v-if="show" class="modal">
<div class="modal_content">
<div class="message xxl">
<slot></slot>
</div>
<button class="button button--info" @click="$emit('reset')">
continue
</button>
</div>
</div>
</Teleport>
</template>
<script setup>
defineProps({
show: Boolean,
});
defineEmits(["reset"]);
</script>
but if i just add a dummy console statement it works
<template>
<Teleport to="body">
<div v-if="show" class="modal">
<div class="modal_content">
<div class="message xxl">
<slot></slot>
</div>
<button class="button button--info" @click="$emit('reset')">
continue
</button>
</div>
</div>
</Teleport>
</template>
<script setup>
defineProps({
show: Boolean,
});
console.log("--silent");
defineEmits(["reset"]);
</script>
any thoughts on why it is happening like this ?
vue.js
unit-testing
jestjs
code-coverage
vue-sfc
0 Answers
Your Answer