-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
29 lines (26 loc) · 993 Bytes
/
jest.config.js
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
const nextJest = require('next/jest');
const createJestConfig = nextJest({
dir: './', // Specify the root directory
});
const customJestConfig = {
testEnvironment: 'jsdom',
resetMocks: true,
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleNameMapper: {
// Handle module aliases for components, pages, and layouts
'^@/cmps/(.*)$': '<rootDir>/cmps/$1',
'^@/providers/(.*)$': '<rootDir>/providers/$1',
'^@/services/(.*)$': '<rootDir>/services/$1',
},
testMatch: [
'<rootDir>/tests/**/*.{js,jsx,ts,tsx}',
'<rootDir>/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/**/*.{spec,test}.{js,jsx,ts,tsx}',
],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest', // Use ts-jest for TypeScript files
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};
module.exports = createJestConfig(customJestConfig);