test: configure Vitest testing framework

- Add vitest, @testing-library/react, @vitest/ui, jsdom dependencies
- Create vitest.config.ts with jsdom environment and coverage settings
- Add tests/setup.ts with localStorage mock and crypto mock
- Add tests/gateway/ws-client.test.ts for GatewayClient unit tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-12 00:48:58 +08:00
parent b8a83b5a26
commit 1d831fb286
5 changed files with 1400 additions and 3 deletions

33
vitest.config.ts Normal file
View File

@@ -0,0 +1,33 @@
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./tests/setup.ts'],
include: ['tests/**/*.test.ts', 'tests/**/*.test.tsx'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
reportsDirectory: './coverage',
include: ['src/**/*.ts', 'desktop/src/**/*.ts', 'desktop/src/**/*.tsx'],
exclude: [
'src/**/*.d.ts',
'desktop/src/**/*.d.ts',
'tests/**',
'**/*.test.ts',
'**/*.test.tsx',
'**/node_modules/**',
],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './desktop/src'),
'@lib': path.resolve(__dirname, './desktop/src/lib'),
},
},
});