cherry-studio/packages/aiCore/vitest.config.ts
suyao f805ddc285
refactor(aiCore): restructure test utilities and fix failing tests
- Move test utilities from src/__tests__/ to test_utils/
- Fix ModelResolver tests for simplified API (2 params instead of 4)
- Fix generateImage/generateText tests with proper vi.fn() mocks
- Fix ExtensionRegistry.parseProviderId to check variants before aliases
- Add createProvider method overload for dynamic provider IDs
- Update ProviderExtension tests for runtime validation behavior
- Delete outdated tests: initialization.test.ts, extensions.integration.test.ts, executor-resolveModel.test.ts
- Remove 3 skipped tests for removed validate hook
- Add HubProvider.integration.test.ts
- All 359 tests passing, 0 skipped

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-02 03:15:50 +08:00

25 lines
679 B
TypeScript

import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
test: {
globals: true,
setupFiles: [path.resolve(__dirname, './test_utils/setup.ts')]
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@test-utils': path.resolve(__dirname, './test_utils'),
// Mock external packages that may not be available in test environment
'@cherrystudio/ai-sdk-provider': path.resolve(__dirname, './test_utils/mocks/ai-sdk-provider.ts')
}
},
esbuild: {
target: 'node18'
}
})