-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest-worker-stall-hack.patch
40 lines (36 loc) · 1.47 KB
/
jest-worker-stall-hack.patch
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
diff --git a/build/workers/ChildProcessWorker.js b/build/workers/ChildProcessWorker.js
index f8a42c961d572ba5110dce6f4bb61dcf0333abc4..938202bee6a4848672b93adcc7598011b0e87a99 100644
--- a/build/workers/ChildProcessWorker.js
+++ b/build/workers/ChildProcessWorker.js
@@ -170,6 +170,15 @@ class ChildProcessWorker {
child.on('message', this._onMessage.bind(this));
child.on('exit', this._onExit.bind(this));
+ console.debug('initialize:', [
+ _types.CHILD_MESSAGE_INITIALIZE,
+ false,
+ this._options.workerPath,
+ this._options.setupArgs
+ ]);
+ console.debug('stalling the main thread for 200ms');
+ const futureTime = Date.now() + 200;
+ while (Date.now() < futureTime);
child.send([
_types.CHILD_MESSAGE_INITIALIZE,
false,
diff --git a/build/workers/processChild.js b/build/workers/processChild.js
index fdf766ec0e3fe013cec19b9c9a5cfb86d4578535..91281b740757fa0519c2ceace7798a534bb39c7a 100644
--- a/build/workers/processChild.js
+++ b/build/workers/processChild.js
@@ -26,6 +26,7 @@ let initialized = false;
*/
const messageListener = request => {
+ console.debug('messageListener:', request);
switch (request[0]) {
case _types.CHILD_MESSAGE_INITIALIZE:
const init = request;
@@ -50,6 +51,7 @@ const messageListener = request => {
};
process.on('message', messageListener);
+console.debug('processChild: registered messageListener');
function reportSuccess(result) {
if (!process || !process.send) {