-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
40 lines (40 loc) · 1.54 KB
/
jest.config.ts
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
module.exports = {
displayName: 'dominion-assistant',
preset: 'ts-jest', // Use 'ts-jest' preset for TypeScript support
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
setupFiles: ['jest-localstorage-mock'],
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/src/**/*.{ts,tsx}',
'!<rootDir>/src/**/*.d.ts',
'!<rootDir>/src/**/*.test.{ts,tsx}',
'!<rootDir>/src/**/*.spec.{ts,tsx}',
'!<rootDir>/src/**/__tests__/**/*.{ts,tsx}',
'!<rootDir>/src/**/__mocks__/**',
],
coverageDirectory: './coverage/dominion-assistant',
coverageReporters: ['json', 'lcov', 'text', 'clover'],
moduleDirectories: ['node_modules', 'src'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'\\.(css|less|scss|sass)$': 'identity-obj-proxy', // Mock CSS imports
},
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[tj]s?(x)',
],
testPathIgnorePatterns: ['/node_modules/', '/__fixtures__/', '/e2e/'],
transform: {
// Pass ts-jest options directly in the transformer
'^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
// Use babel-jest for JavaScript files (optional, if you have JS files)
'^.+\\.(js|jsx)$': 'babel-jest',
// Handle static assets and CSS modules
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
},
// Removed the deprecated 'globals' key
};