-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjest.config.js
More file actions
31 lines (28 loc) · 1.2 KB
/
jest.config.js
File metadata and controls
31 lines (28 loc) · 1.2 KB
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
const nextJest = require('next/jest')
/** @type {import('jest').Config} */
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})
// Add any custom config to be passed to Jest
const config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
// Add more setup options before each test is run
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleNameMapper: {
'^app/(.*)$': ['<rootDir>/src/app/$1'],
'^components$': ['<rootDir>/src/components'],
'^components/(.*)$': ['<rootDir>/src/components/$1'],
'^entities/(.*)$': ['<rootDir>/src/entities/$1'],
'^features/(.*)$': ['<rootDir>/src/features/$1'],
'^pages/(.*)$': ['<rootDir>/src/pages/$1'],
'^shared/(.*)$': ['<rootDir>/src/shared/$1'],
'^widgets/(.*)$': ['<rootDir>/src/widgets/$1'],
'^__mocks__/(.*)$': ['<rootDir>/src/__mocks__/$1'],
},
modulePathIgnorePatterns : ['test-const'],
restoreMocks: true,
}
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(config)