mirror of https://github.com/status-im/metro.git
Update some JS in preparation for some Jest updates.
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
This commit is contained in:
parent
fc38304bf8
commit
21be7ecccf
|
@ -16,11 +16,18 @@ const Bundler = require('../Bundler');
|
|||
const Promise = require('promise');
|
||||
const SourceMapConsumer = require('source-map').SourceMapConsumer;
|
||||
|
||||
const _ = require('lodash');
|
||||
const declareOpts = require('../lib/declareOpts');
|
||||
const path = require('path');
|
||||
const url = require('url');
|
||||
|
||||
function debounce(fn, delay) {
|
||||
var timeout;
|
||||
return () => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(fn, delay);
|
||||
};
|
||||
}
|
||||
|
||||
const validateOpts = declareOpts({
|
||||
projectRoots: {
|
||||
type: 'array',
|
||||
|
@ -209,7 +216,7 @@ class Server {
|
|||
|
||||
this._fileWatcher.on('all', this._onFileChange.bind(this));
|
||||
|
||||
this._debouncedFileChangeHandler = _.debounce(filePath => {
|
||||
this._debouncedFileChangeHandler = debounce(filePath => {
|
||||
this._clearBundles();
|
||||
this._informChangeWatchers();
|
||||
}, 50);
|
||||
|
|
Loading…
Reference in New Issue