From 032757a6e5e48518775bb307f982d56b7c7bde57 Mon Sep 17 00:00:00 2001 From: Alex Bass Date: Thu, 8 Mar 2018 22:26:00 +0100 Subject: [PATCH] Stop worker being redefined and breaking Jest #1635 (#1695) --- lib/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 0458588e..b8350fe1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -122,7 +122,9 @@ require('./extensions')(realmConstructor); if (realmConstructor.Sync) { if (getContext() === 'nodejs') { nodeRequire('./notifier')(realmConstructor); - Object.defineProperty(realmConstructor, 'Worker', {value: nodeRequire('./worker')}); + if (!realmConstructor.Worker) { + Object.defineProperty(realmConstructor, 'Worker', {value: nodeRequire('./worker')}); + } } }