Reputation: 71
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
Upvotes: 6
Views: 5720
Reputation: 9372
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.
Upvotes: 14