-
Notifications
You must be signed in to change notification settings - Fork 338
/
.jest-config.js
44 lines (42 loc) · 1.57 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
const { jsWithTs: tsjPreset } = require('ts-jest/presets')
const externalTsModules = require('./build/external').externalTsModules
const externalTsModuleMappings = {}
for (const [alias, relPath] of Object.entries(externalTsModules)) {
Object.assign(externalTsModuleMappings, {
[`^${alias}$`]: `<rootDir>/external/${relPath}/ts`,
[`^${alias}/lib/(.*)`]: `<rootDir>/external/${relPath}/ts/$1`,
})
}
module.exports = {
testMatch: ['<rootDir>/src/**/*.test.(js|jsx|ts|tsx)'],
rootDir: '.',
transform: {
...tsjPreset.transform,
},
testEnvironment: 'node',
transformIgnorePatterns: ['/node_modules/(?!(firebase|@firebase)/)'],
modulePaths: ['<rootDir>'],
moduleNameMapper: {
'\\.(css|less)$': 'identity-obj-proxy',
...externalTsModuleMappings,
'linkedom/worker': 'linkedom',
},
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
setupFiles: ['jest-webextension-mock', './setupJest.js'],
resolver: '<rootDir>/jest.resolver.js',
unmockedModulePathPatterns: [
'<rootDir>/node_modules/react',
'<rootDir>/node_modules/react-dom',
'<rootDir>/node_modules/react-addons-test-utils',
'<rootDir>/node_modules/fbjs',
],
globals: {
'ts-jest': {
// This apparently speeds things up, at the expense of type-checking
// https://github.com/kulshekhar/ts-jest/issues/259#issuecomment-888978737
isolatedModules: true,
},
},
// Enable this to get type-checking back (maybe when we get CI set up again)
// maxWorkers: 1,
}