-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
33 lines (32 loc) · 1003 Bytes
/
jest.config.js
File metadata and controls
33 lines (32 loc) · 1003 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
33
const baseConfig = env => ({
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': '<rootDir>/node_modules/babel-jest',
'^.+\\.css$': '<rootDir>/node_modules/razzle/config/jest/cssTransform.js',
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)':
'<rootDir>/node_modules/razzle/config/jest/fileTransform.js'
},
testMatch: [
`<rootDir>/src/${env}/**/__tests__/**/*.{js,jsx,ts,tsx}`,
`<rootDir>/src/${env}/**/*.{test,spec}.{js,jsx,ts,tsx}`
]
})
module.exports = {
setupFilesAfterEnv: ['<rootDir>/src/tests/setup.ts'],
projects: [
Object.assign(baseConfig('client'), {
displayName: 'client',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/src/client/tests/setup.ts']
}),
Object.assign(baseConfig('server'), {
displayName: 'server',
testEnvironment: 'node'
}),
Object.assign(baseConfig('e2e'), {
displayName: 'e2e',
testEnvironment: 'node',
testMatch: ['<rootDir>/src/tests/**/*.{test,spec}.{js,jsx,ts,tsx}']
})
]
}