This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
66 lines (62 loc) · 2.18 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const { pathsToModuleNameMapper } = require('ts-jest/utils')
const { compilerOptions } = require('./tsconfig')
const aliases = pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
})
delete aliases['^@assets/(.*)$']
let jest_config = {
preset: 'ts-jest/presets/js-with-babel',
transform: {
'^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg.+|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)(\\?.+)?$':
'<rootDir>/__tests__/fileTransformer.js',
},
snapshotSerializers: ['enzyme-to-json/serializer'],
testMatch: null,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^.+\\.svg\\?(sprite|include)(.+)?$': '<rootDir>/__mocks__/svgMock.js',
'^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg.+|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)(\\?.+)\\?(resize|sizes)(.+)?$':
'<rootDir>/__mocks__/fileResizeMock.js',
'^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg.+|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)(\\?.+)?$':
'<rootDir>/__mocks__/fileMock.js',
'^.+\\.(css|less|scss)$': '<rootDir>/__mocks__/styleMock.js',
...aliases,
},
setupFiles: ['<rootDir>/__tests__/setupTests.js'],
collectCoverage: false,
collectCoverageFrom: [
'components/**/*.{ts,tsx}',
'pages/**/*.{ts,tsx}',
'server/**/*.{ts,tsx}',
'store/**/*.{ts,tsx}',
],
globals: {
'ts-jest': {
diagnostics: false,
babelConfig: true,
tsConfig: 'tsconfig.test.json',
},
},
}
module.exports = {
projects: [
{
displayName: 'general',
testRegex: '/__tests__/unit/.*\\.test.(ts|tsx|js)$',
testEnvironment: 'node',
...jest_config,
},
// {
// displayName: 'server',
// testRegex: '/__tests__/.*\\.server.test.(ts|tsx|js)$',
// testEnvironment: 'node',
// ...jest_config,
// },
// {
// displayName: 'client',
// testRegex: '/__tests__/.*\\.client.test.(ts|tsx|js)$',
// testEnvironment: 'jsdom',
// ...jest_config,
// },
],
}