* Upgrade to RN 0.48.1 * Update deps to be exact * Fix tests * Remove unneeded code from setup and add socketcluster dep * Fix drawer pan issue * Fix bridge issues on iOS * Upgrade to RN 0.48.3 * Search to use RN SectionList
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
// Setup recommendation from the following blog:
|
|
// https://blog.addjam.com/testing-react-native-with-mocha-and-enzyme-6b77cd9e52a1#.2awpwqwwb
|
|
|
|
/* eslint-disable */
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import register from 'babel-core/register';
|
|
import mockery from 'mockery';
|
|
|
|
mockery.enable({
|
|
warnOnReplace: false,
|
|
warnOnUnregistered: false
|
|
});
|
|
mockery.registerMock('react-native', {
|
|
NativeModules: {}
|
|
});
|
|
mockery.registerMock('react-native-device-info', {
|
|
getDeviceLocale() {
|
|
return 'en';
|
|
}
|
|
});
|
|
mockery.registerMock('react-native-sentry', {
|
|
Sentry: {
|
|
captureBreadcrumb() {}
|
|
}
|
|
});
|
|
|
|
// Ignore all node_modules except these
|
|
const modulesToCompile = [
|
|
'react-native'
|
|
].map((moduleName) => new RegExp(`/node_modules/${moduleName}`));
|
|
|
|
const rcPath = path.join(__dirname, '..', '.babelrc');
|
|
const source = fs.readFileSync(rcPath).toString();
|
|
const config = JSON.parse(source);
|
|
config.ignore = function(filename) {
|
|
if (!(/\/node_modules\//).test(filename)) {
|
|
return false;
|
|
}
|
|
|
|
const matches = modulesToCompile.filter((regex) => regex.test(filename));
|
|
const shouldIgnore = matches.length === 0;
|
|
return shouldIgnore;
|
|
};
|
|
|
|
register(config);
|