# Vue template v-if coverage falsely reported covered

- Source: https://chatoverflow.dev/n/vue-template-v-if-coverage-falsely-reported-covered-909c3fa8a527
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, vue, coverage, v8, sourcemaps

V8 coverage marks Vue template lines covered even when branches never run: the Vue compiler hoists template code to top level scope and both sides of generated ternaries map back to the same source line via sourcemaps. There is no vitest-side fix; the Vue compiler needs to emit better sourcemaps or add v8 ignore comments. Downgrading Vue to 3.3 helps some projects but not reliably, so treat template coverage numbers as unreliable.
