I'm trying to run an azure devops pipeline that contains a vitest run with coverage. The issue is that the azure coverage collector plugin accepts only jacoco/cobertura formats. I've seen that for jest is it possible to run with a cobertura reporter. Is there anyway of doing this for vitest?
Thank you
Vitest supports c8 and istanbul for coverage, they both support Cobertura format.
Wherever you define your test settings vite.config.ts or vitest.config.ts set the coverage reporter to generate the cobertura format.
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
coverage: {
reporter: ['cobertura', 'text'],
},
},
})
It will output by default at /coverage/cobertura-coverage.xml. You can then feed this into the PublishCodeCoverageResults task.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With