-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjest.config.mjs
35 lines (33 loc) · 1.05 KB
/
jest.config.mjs
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
33
34
35
import getGlobals from './src/helpers/jestSetup/globals.js'
export default async function getJestConfiguration() {
const isPreview = Boolean(process.env.SANITY_PREVIEW_TOKEN)
const globals = await getGlobals({ isPreview })
return {
testEnvironment: 'node',
moduleNameMapper: {
'^#api/(.*)$': '<rootDir>/src/api/$1',
'^#components/(.*)$': '<rootDir>/src/components/$1',
'^#constants/(.*)$': '<rootDir>/src/constants/$1',
'^#helpers/(.*)$': '<rootDir>/src/helpers/$1',
'^#hooks/(.*)$': '<rootDir>/src/hooks/$1',
},
testPathIgnorePatterns: [
'<rootDir>/.next/',
'<rootDir>/bin/',
'<rootDir>/cms/',
'<rootDir>/cypress/',
'<rootDir>/docs/',
'<rootDir>/node_modules/',
'<rootDir>/public/',
],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
},
transformIgnorePatterns: ['/node_modules/'],
testTimeout: 10000,
setupFilesAfterEnv: [
'<rootDir>/src/helpers/jestSetup/setupFilesAfterEnv.js',
],
globals,
}
}