mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 04:31:27 +08:00
- Updated electron.vite.config.ts to use dynamic imports for Tailwind CSS. - Refactored vitest.config.ts to asynchronously retrieve renderer configuration from electron.vite.config. - Enhanced plugin and alias management for better maintainability and performance.
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vitest/config'
|
|
|
|
import electronViteConfig from './electron.vite.config'
|
|
|
|
// const rendererConfig = electronViteConfig.renderer
|
|
|
|
export default defineConfig(async () => {
|
|
const rendererConfig = (await electronViteConfig()).renderer
|
|
console.log('rendererConfig', rendererConfig)
|
|
// 复用 renderer 插件和路径别名
|
|
return {
|
|
plugins: rendererConfig.plugins,
|
|
resolve: {
|
|
alias: rendererConfig.resolve.alias
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: [],
|
|
include: [
|
|
// 只测试渲染进程
|
|
'src/renderer/**/*.{test,spec}.{ts,tsx}',
|
|
'src/renderer/**/__tests__/**/*.{ts,tsx}'
|
|
],
|
|
exclude: ['**/node_modules/**', '**/dist/**', '**/out/**', '**/build/**'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html', 'lcov'],
|
|
exclude: [
|
|
'**/node_modules/**',
|
|
'**/dist/**',
|
|
'**/out/**',
|
|
'**/build/**',
|
|
'**/coverage/**',
|
|
'**/.yarn/**',
|
|
'**/.cursor/**',
|
|
'**/.vscode/**',
|
|
'**/.github/**',
|
|
'**/.husky/**',
|
|
'**/*.d.ts',
|
|
'**/types/**',
|
|
'**/__tests__/**',
|
|
'**/*.{test,spec}.{ts,tsx}',
|
|
'**/*.config.{js,ts}',
|
|
'**/electron.vite.config.ts',
|
|
'**/vitest.config.ts'
|
|
]
|
|
},
|
|
testTimeout: 20000,
|
|
pool: 'threads',
|
|
poolOptions: {
|
|
threads: {
|
|
singleThread: false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|