-
Notifications
You must be signed in to change notification settings - Fork 47
/
jest.config.js
32 lines (27 loc) · 938 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
const nextJest = require('next/jest')
const TEST_REGEX = '(/__tests__/.*|(\\.|/)(test|spec))\\.(js?|jsx?|tsx?|ts?)$'
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
testRegex: TEST_REGEX,
testEnvironment: 'jest-environment-jsdom',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
collectCoverage: false,
}
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})(customJestConfig)
module.exports = async () => {
const jestConfig = await createJestConfig()
const moduleNameMapper = {
...jestConfig.moduleNameMapper,
'^@components/(.*)$': '<rootDir>/src/components/$1',
'^@containers/(.*)$': '<rootDir>/src/containers/$1',
'^@common/(.*)$': '<rootDir>/src/common/$1',
'^@store/(.*)$': '<rootDir>/src/store/$1',
}
return {
...jestConfig,
moduleNameMapper
}
}