-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
22 lines (22 loc) · 894 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
module.exports = {
testEnvironment: 'jsdom',
roots: ['<rootDir>/components', '<rootDir>/shared'],
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
snapshotSerializers: ['enzyme-to-json/serializer'],
// https://github.com/zeit/next.js/issues/8663#issue-490553899
globals: {
// we must specify a custom tsconfig for tests because we need the typescript transform
// to transform jsx into js rather than leaving it jsx such as the next build requires. you
// can see this setting in tsconfig.jest.json -> "jsx": "react"
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.jest.json',
},
},
};