124 lines
2.8 KiB
JavaScript
124 lines
2.8 KiB
JavaScript
import { defineConfig } from 'vitest/config'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { resolve } from 'path'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
test: {
|
|
// Test environment
|
|
environment: 'jsdom',
|
|
|
|
// Global setup files
|
|
setupFiles: [
|
|
'./src/components/workorders/__tests__/setup.js'
|
|
],
|
|
|
|
// Include patterns
|
|
include: [
|
|
'src/**/*.{test,spec}.{js,ts}',
|
|
'src/**/__tests__/**/*.{js,ts}'
|
|
],
|
|
|
|
// Exclude patterns
|
|
exclude: [
|
|
'node_modules',
|
|
'dist',
|
|
'.nuxt',
|
|
'coverage'
|
|
],
|
|
|
|
// Coverage configuration
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
include: [
|
|
'src/components/workorders/**/*.{js,ts,vue}',
|
|
'src/composables/**/*.{js,ts}',
|
|
'src/repositories/**/*.{js,ts}',
|
|
'src/stores/**/*.{js,ts}'
|
|
],
|
|
exclude: [
|
|
'src/**/__tests__/**',
|
|
'src/**/*.test.{js,ts}',
|
|
'src/**/*.spec.{js,ts}',
|
|
'src/**/index.{js,ts}',
|
|
'src/**/*.d.ts'
|
|
],
|
|
thresholds: {
|
|
global: {
|
|
branches: 80,
|
|
functions: 80,
|
|
lines: 80,
|
|
statements: 80
|
|
},
|
|
// Higher thresholds for critical components
|
|
'src/components/workorders/TimeTracker.vue': {
|
|
branches: 90,
|
|
functions: 90,
|
|
lines: 90,
|
|
statements: 90
|
|
},
|
|
'src/components/workorders/CostTracker.vue': {
|
|
branches: 85,
|
|
functions: 85,
|
|
lines: 85,
|
|
statements: 85
|
|
}
|
|
}
|
|
},
|
|
|
|
// Test timeout
|
|
testTimeout: 10000,
|
|
hookTimeout: 10000,
|
|
|
|
// Parallel execution
|
|
threads: true,
|
|
maxThreads: 4,
|
|
minThreads: 1,
|
|
|
|
// Reporter configuration
|
|
reporter: ['verbose', 'html'],
|
|
outputFile: {
|
|
html: './coverage/test-results.html'
|
|
},
|
|
|
|
// Mock configuration
|
|
server: {
|
|
deps: {
|
|
inline: [
|
|
'@vue/test-utils'
|
|
]
|
|
}
|
|
},
|
|
|
|
// Globals
|
|
globals: true,
|
|
|
|
// Environment options
|
|
environmentOptions: {
|
|
jsdom: {
|
|
resources: 'usable'
|
|
}
|
|
}
|
|
},
|
|
|
|
// Resolve configuration for imports
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, './src'),
|
|
'~': resolve(__dirname, './src'),
|
|
'components': resolve(__dirname, './src/components'),
|
|
'composables': resolve(__dirname, './src/composables'),
|
|
'stores': resolve(__dirname, './src/stores'),
|
|
'repositories': resolve(__dirname, './src/repositories'),
|
|
'types': resolve(__dirname, './src/types'),
|
|
'utils': resolve(__dirname, './src/utils')
|
|
}
|
|
},
|
|
|
|
// Define configuration for different environments
|
|
define: {
|
|
__VUE_OPTIONS_API__: true,
|
|
__VUE_PROD_DEVTOOLS__: false
|
|
}
|
|
}) |