From 93287f2aa3ffe3799e31dc6ceb251245fb4bd16b Mon Sep 17 00:00:00 2001 From: cpojer Date: Fri, 6 Nov 2015 21:39:41 -0800 Subject: [PATCH] Remove preload options in TestWorker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn’t serve any purpose. We call `runTest` in workers right after we were calling these preload methods which implicitly called the the preload methods themselves. --- src/TestRunner.js | 30 ------------------------------ src/TestWorker.js | 25 ++----------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/src/TestRunner.js b/src/TestRunner.js index a6251cc8dfc0..b28a5af4ddbd 100644 --- a/src/TestRunner.js +++ b/src/TestRunner.js @@ -206,36 +206,6 @@ class TestRunner { }); } - /** - * For use by external users of TestRunner as a means of optimization. - * - * Imagine the following scenario executing in a child worker process: - * - * var runner = new TestRunner(config, { - * moduleLoaderResourceMap: serializedResourceMap - * }); - * someOtherAyncProcess.then(function() { - * runner.runTestsParallel(); - * }); - * - * Here we wouldn't start deserializing the resource map (passed to us from - * the parent) until runner.runTestsParallel() is called. At the time of this - * writing, resource map deserialization is slow and a bottleneck on running - * the first test in a child. - * - * So this API gives scenarios such as the one above an optimization path to - * potentially start deserializing the resource map while we wait on the - * someOtherAsyncProcess to resolve (rather that doing it after it's - * resolved). - */ - preloadResourceMap() { - this._getModuleLoaderResourceMap().then(null, promiseDone); - } - - preloadConfigDependencies() { - this._loadConfigDependencies(); - } - /** * Run the given single test file path. * This just contains logic for running a single test given it's file path. diff --git a/src/TestWorker.js b/src/TestWorker.js index 8068a810ea3d..f58fcde9d5e2 100644 --- a/src/TestWorker.js +++ b/src/TestWorker.js @@ -8,9 +8,7 @@ 'use strict'; // Make sure uncaught errors are logged before we exit. -// Could be transient errors to do with loading and serializing the resouce -// map. -process.on('uncaughtException', (err) => { +process.on('uncaughtException', err => { console.error(err.stack); process.exit(1); }); @@ -19,30 +17,11 @@ const TestRunner = require('./TestRunner'); let testRunner; -module.exports = function testWorker(data, callback) { +module.exports = (data, callback) => { if (!testRunner) { testRunner = new TestRunner(data.config, { useCachedModuleLoaderResourceMap: true, }); - - // Start require()ing config dependencies now. - // - // Config dependencies are entries in the config that are require()d (in - // order to be pluggable) such as 'moduleLoader' or - // 'testEnvironment'. - testRunner.preloadConfigDependencies(); - - // Start deserializing the resource map to get a potential head-start on - // that work before the first "run-test" message comes in. - // - // This is just a perf optimization -- and it is only an optimization - // some of the time (when the there is any significant idle time between - // this first initialization message and the first "run-rest" message). - // - // It is also only an optimization so long as deserialization of the - // resource map is a bottleneck (which is the case at the time of this - // writing). - testRunner.preloadResourceMap(); } try {