forked from WorldBrain/Memex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.jest-config.js
38 lines (36 loc) · 1.21 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
const { jsWithTs: tsjPreset } = require('ts-jest/presets')
const externalTsModules = require('./build/external').externalTsModules
const externalTsModuleMappings = {}
for (const externalTsModule of externalTsModules) {
Object.assign(externalTsModuleMappings, {
[`^${externalTsModule}$`]: `<rootDir>/external/${externalTsModule}/ts`,
[`^${externalTsModule}/lib/(.*)`]: `<rootDir>/external/${externalTsModule}/ts/$1`,
})
}
module.exports = {
globals: {
'ts-jest': {
tsConfig: 'tsconfig.jest.json',
babelConfig: true,
},
browser: {},
},
testMatch: ['<rootDir>/src/**/*.test.(js|jsx|ts|tsx)'],
rootDir: '.',
transform: {
...tsjPreset.transform,
},
modulePaths: ['<rootDir>'],
moduleNameMapper: {
'\\.(css|less)$': 'identity-obj-proxy',
...externalTsModuleMappings,
},
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
setupFiles: ['jest-webextension-mock', './setupJest.js'],
unmockedModulePathPatterns: [
'<rootDir>/node_modules/react',
'<rootDir>/node_modules/react-dom',
'<rootDir>/node_modules/react-addons-test-utils',
'<rootDir>/node_modules/fbjs',
],
}