-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
32 lines (26 loc) · 747 Bytes
/
jest.config.js
File metadata and controls
32 lines (26 loc) · 747 Bytes
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 customJestConfig = {
/* With custom configuration */
}
const createJestConfig = nextJest({
dir: './',
})(customJestConfig)
module.exports = async () => {
// Create Next.js jest configuration presets
const jestConfig = await createJestConfig()
const setupFilesAfterEnv = ['./test/jest.setup.js']
// Custom `moduleNameMapper` configuration
const moduleNameMapper = {
...jestConfig.moduleNameMapper,
'^@components(.*)$': '<rootDir>/components$1',
'^@pages(.*)$': '<rootDir>/pages$1',
'^@/(.*)$': '<rootDir>/$1',
}
const testEnvironment = 'jest-environment-jsdom'
return {
...jestConfig,
setupFilesAfterEnv,
moduleNameMapper,
testEnvironment,
}
}