-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
58 lines (57 loc) · 1.5 KB
/
Copy pathjest.config.js
File metadata and controls
58 lines (57 loc) · 1.5 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
57
58
/** @type {import('jest').Config} */
const config = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
// Handle ES modules from node_modules
extensionsToTreatAsEsm: ['.ts', '.tsx'],
globals: {
'ts-jest': {
useESM: true,
tsconfig: {
jsx: 'react-jsx',
},
},
},
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
useESM: true,
}],
},
// Transform ES modules from node_modules
transformIgnorePatterns: [
'node_modules/(?!(@supabase|supabase|isows|ws|@babel|@testing-library|undici|@vercel|@next))',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
// Handle CSS and other assets
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.{ts,tsx}',
'!src/types/**',
],
coveragePathIgnorePatterns: [
'/node_modules/',
'/src/types/',
'/src/**/*.stories.{ts,tsx}',
],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{ts,tsx}',
'<rootDir>/src/**/*.{test,spec}.{ts,tsx}',
],
testTimeout: 10000,
// Add better error handling
verbose: true,
maxWorkers: '50%',
// Handle dynamic imports and ES modules
resolver: undefined,
// Environment variables for testing
testEnvironmentOptions: {
url: 'http://localhost:3000',
},
};
module.exports = config;