-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
61 lines (60 loc) · 1.91 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
const defaults = {
collectCoverageFrom: ['**/*.{js}'],
moduleNameMapper: {
'\\.(css|less)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'^react-native$': 'react-native-web'
},
preset: 'react-native-web',
resolver: 'jest-pnp-resolver',
setupFiles: ['react-app-polyfill/jsdom'],
setupFilesAfterEnv: ['<rootDir>/.jest.init.js'],
testMatch: [
'<rootDir>/**/__tests__/**/*.js',
'<rootDir>/**/?(*.)(spec|test).js'
],
transform: {
'^.+\\.(js)$': '<rootDir>/node_modules/babel-jest'
},
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$']
}
module.exports = {
projects: [
{
...defaults,
displayName: 'base',
globals: {
TEST_TARGET: 'function'
},
moduleFileExtensions: ['js', 'json'],
testEnvironment: 'node'
},
// TODO BRN: Need to figure this out. Right now when we set this up it
// overrides the loadConfig methods to the web based ones which use memfs.
// However, nothing is loaded into memfs so there's no way of loading the
// configs and booting up the context properly. Plus, the test system
// requires access to the admin contexts for some setup which web will never
// need. Almost seems that we need access to two separate environments. The
// "web" one when running the tests and the "test" one when setting up tests.
// {
// ...defaults,
// displayName: 'web',
// globals: {
// TEST_TARGET: 'web'
// },
// moduleFileExtensions: ['web.js', 'js', 'json'],
// testEnvironment: 'jsdom',
// testURL: 'http://localhost'
// },
{
...defaults,
displayName: 'ssr',
globals: {
TEST_TARGET: 'ssr'
},
moduleFileExtensions: ['ssr.js', 'web.js', 'js', 'json'],
testEnvironment: 'node'
}
]
}