mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 03:56:03 +00:00
89a9ca6688
Summary: * Next version of Jest doesn't allow non test files in __tests__ folders. * I'm trying to switch all tests off of jsdom on react-native. This should save 500ms of time when running a single test because jsdom is slow to load and react-native is also not supposed to run in a DOM environment, so let's not pretend we are providing the DOM in tests. * Make the bridge config configurable so that when we disable automocking and we reset the registry we can redefine the value. Oh also, stop using lodash in Server.js. First off, lodash 3 doesn't work in Jest's node env because it does some crazy stuff, second because we don't need to load all of lodash for debounce. Reviewed By: davidaurelio Differential Revision: D3502886 fbshipit-source-id: 1da1cfba9ed12264d81945b702e7a429d5f84424
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule BatchedBridge
|
|
*/
|
|
'use strict';
|
|
|
|
const MessageQueue = require('MessageQueue');
|
|
|
|
const serializeNativeParams = typeof global.__fbBatchedBridgeSerializeNativeParams !== 'undefined';
|
|
|
|
const BatchedBridge = new MessageQueue(
|
|
() => global.__fbBatchedBridgeConfig,
|
|
serializeNativeParams
|
|
);
|
|
|
|
// TODO: Move these around to solve the cycle in a cleaner way.
|
|
|
|
const Systrace = require('Systrace');
|
|
const JSTimersExecution = require('JSTimersExecution');
|
|
|
|
BatchedBridge.registerCallableModule('Systrace', Systrace);
|
|
BatchedBridge.registerCallableModule('JSTimersExecution', JSTimersExecution);
|
|
BatchedBridge.registerCallableModule('HeapCapture', require('HeapCapture'));
|
|
|
|
if (__DEV__) {
|
|
BatchedBridge.registerCallableModule('HMRClient', require('HMRClient'));
|
|
}
|
|
|
|
// Wire up the batched bridge on the global object so that we can call into it.
|
|
// Ideally, this would be the inverse relationship. I.e. the native environment
|
|
// provides this global directly with its script embedded. Then this module
|
|
// would export it. A possible fix would be to trim the dependencies in
|
|
// MessageQueue to its minimal features and embed that in the native runtime.
|
|
|
|
Object.defineProperty(global, '__fbBatchedBridge', {
|
|
configurable: true,
|
|
value: BatchedBridge,
|
|
});
|
|
|
|
module.exports = BatchedBridge;
|