Reputation: 65
I am running Cypress component tests for a vue3+vite app. Instrumentation is done via vite-instanbul plugin. In cypress, I am able to get window.__ coverage__ and see the counters on different files. However, these files are never in the report. In the report, I only have the files that are not tested and thus get a report full of 0s.. Below is my config:
// cypress.config.ts
import { defineConfig } from 'cypress'
export default defineConfig({
component: {
specPattern: 'src/**/__tests__/**/*.{cy,spec}.{js,ts,jsx,tsx}',
devServer: {
framework: 'vue',
bundler: 'vite'
},
video: false,
screenshotOnRunFailure: false,
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config)
return config
}
}
})
// vite.config.ts
return {
plugins: [
vue(),
VueI18nPlugin({
include: path.resolve(__dirname, './src/**/*'),
globalSFCScope: true
}),
svgLoader({
svgo: false
}),
istanbul()
],
// .nycrc
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"check-coverage": true,
"reporter": ["text", "lcov", "cobertura"],
"extension": [".ts", ".vue"]
}
Upvotes: 0
Views: 67