-
Notifications
You must be signed in to change notification settings - Fork 607
/
metro.config.js
45 lines (40 loc) · 1.51 KB
/
metro.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
const blacklist = require('metro-config/src/defaults/blacklist')
const path = require('path')
const glob = require('glob-to-regexp')
const getBlacklistRE = () => {
// ignore dist/, dev/
const defaultPattern = blacklist([
glob(`${path.resolve(__dirname, '..')}/dist/*`),
glob(`${path.resolve(__dirname, '..')}/dev/*`),
glob(`${path.resolve(__dirname, '..')}/example/*`),
])
.toString()
.slice(1, -1)
// delete __tests__ from the default blacklist
const newPattern = defaultPattern.replace(`|.*\\/__tests__\\/.*`, '')
return RegExp(newPattern)
}
const config = {
projectRoot: path.resolve(__dirname),
watchFolders: [
path.resolve(__dirname, 'native'),
path.resolve(__dirname, 'node_modules', '@babel'),
],
resolver: {
extraNodeModules: {
// We need `expect` package for RN integration tests… but the damn thing expects to be in jest
// (Node) environment… so we have to mock a bunch of stuff for this to work
fs: path.resolve(__dirname, 'src/__tests__/emptyMock'),
'graceful-fs': path.resolve(__dirname, 'src/__tests__/emptyMock'),
module: path.resolve(__dirname, 'src/__tests__/emptyMock'),
assert: path.resolve(__dirname, 'src/__tests__/emptyMock'),
stream: path.resolve(__dirname, 'src/__tests__/emptyMock'),
constants: path.resolve(__dirname, 'src/__tests__/emptyMock'),
},
blacklistRE: getBlacklistRE(),
},
transformer: {
babelTransformerPath: path.resolve(__dirname, 'rn-transformer.js'),
},
}
module.exports = config