- Update Jest config to use ts-jest for better TypeScript support - Add TSX test file pattern support for React components - Improve Babel config with proper TypeScript preset settings - Enable better import.meta transformation for Jest compatibility
43 lines
1.2 KiB
JSON
43 lines
1.2 KiB
JSON
{
|
|
"testEnvironment": "jsdom",
|
|
"setupFilesAfterEnv": ["<rootDir>/tests/setup.ts"],
|
|
"testMatch": [
|
|
"<rootDir>/services/**/__tests__/**/*.test.ts",
|
|
"<rootDir>/utils/**/__tests__/**/*.test.ts",
|
|
"<rootDir>/types/**/__tests__/**/*.test.ts",
|
|
"<rootDir>/components/**/__tests__/**/*.test.tsx",
|
|
"<rootDir>/tests/**/*.test.ts",
|
|
"<rootDir>/tests/**/*.test.tsx",
|
|
"<rootDir>/tests/**/*.test.js"
|
|
],
|
|
"collectCoverageFrom": [
|
|
"services/**/*.ts",
|
|
"components/**/*.tsx",
|
|
"hooks/**/*.ts",
|
|
"utils/**/*.ts",
|
|
"types/**/*.ts",
|
|
"!**/*.d.ts",
|
|
"!**/__tests__/**"
|
|
],
|
|
"coverageDirectory": "coverage",
|
|
"coverageReporters": ["text", "lcov", "html"],
|
|
"moduleNameMapper": {
|
|
"^@/(.*)$": "<rootDir>/$1",
|
|
"^node-fetch$": "<rootDir>/tests/__mocks__/node-fetch.js"
|
|
},
|
|
"transform": {
|
|
"^.+\\.tsx?$": [
|
|
"ts-jest",
|
|
{
|
|
"tsconfig": "tsconfig.json",
|
|
"babelConfig": "babel.config.cjs",
|
|
"diagnostics": false
|
|
}
|
|
],
|
|
"^.+\\.jsx?$": "babel-jest"
|
|
},
|
|
"transformIgnorePatterns": ["node_modules/(?!(@jest/transform|uuid|node-fetch)/)"],
|
|
"testTimeout": 30000,
|
|
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
|
|
}
|