-
Notifications
You must be signed in to change notification settings - Fork 3
/
jest.config.js
32 lines (31 loc) · 980 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
30
31
32
module.exports = {
roots: ['<rootDir>'],
testEnvironment: 'jest-environment-jsdom',
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.[jt]sx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx'],
// moduleNameMapper needs to match compilerOptions.paths in tsconfig
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'\\.(css|scss|sass)$': 'identity-obj-proxy' // Mock CSS module imports
},
testPathIgnorePatterns: [
'<rootDir>/.next/',
'<rootDir>[/\\\\](node_modules|.next)[/\\\\]',
'<rootDir>/.jest/test-utils.tsx',
'<rootDir>/__mocks__/*'
],
transform: {
// This is necessary because next.js forces { "jsx": "preserve" }, but
// ts-jest appears to require { "jsx": "react" }
'^.+\\.[jt]sx?$': [
'ts-jest',
{
tsconfig: {
jsx: 'react-jsx'
}
}
],
'\\.tsx?$': ['ts-jest', {}] // TypeScript files
},
transformIgnorePatterns: ['/node_modules/', '^.+\\.module\\.(css)$']
};