-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvitest.config.ts
More file actions
56 lines (55 loc) · 2.1 KB
/
vitest.config.ts
File metadata and controls
56 lines (55 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()] as any,
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
// Explicitly include SDK package tests
include: [
'src/**/*.test.{ts,tsx}',
'packages/sdk/test/**/*.test.js',
],
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/cypress/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
// Skip blockchain tests due to ws CommonJS/ESM incompatibility (except providers.test.ts which is fully mocked)
'src/lib/blockchain/wallets.test.ts',
'src/lib/blockchain/monitor.test.ts',
// Skip system-wallet test due to ethers/ws CommonJS/ESM incompatibility
'src/lib/wallets/system-wallet.test.ts',
// Skip payment service tests that import system-wallet (ethers/ws issue)
'src/lib/payments/service.test.ts',
'src/lib/payments/service.expiration.test.ts',
// Skip API route tests that pull system-wallet through payment flow (same ws issue)
'src/app/api/payments/route.test.ts',
'src/app/api/cron/monitor-payments/route.test.ts',
],
environmentMatchGlobs: [
// Use jsdom for React component tests
['**/*.tsx', 'jsdom'],
// Use node for everything else
['**/*.ts', 'node'],
// SDK tests use node environment
['packages/sdk/**/*.js', 'node'],
],
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
// Force ws to ESM-compatible shim during tests (ethers transitively imports ws)
'ws': path.resolve(__dirname, './src/test/ws-shim.ts'),
'@noble/curves/secp256k1': path.resolve(__dirname, './node_modules/@noble/curves/secp256k1.js'),
'@noble/curves/ed25519': path.resolve(__dirname, './node_modules/@noble/curves/ed25519.js'),
},
conditions: ['node', 'import', 'module', 'browser', 'default'],
},
define: {
'global': 'globalThis',
},
});