Stop worker being redefined and breaking Jest #1635 (#1695)

This commit is contained in:
Alex Bass 2018-03-08 22:26:00 +01:00 committed by Thomas Goyne
parent 09b47d3348
commit 032757a6e5
1 changed files with 3 additions and 1 deletions

View File

@ -122,8 +122,10 @@ require('./extensions')(realmConstructor);
if (realmConstructor.Sync) { if (realmConstructor.Sync) {
if (getContext() === 'nodejs') { if (getContext() === 'nodejs') {
nodeRequire('./notifier')(realmConstructor); nodeRequire('./notifier')(realmConstructor);
if (!realmConstructor.Worker) {
Object.defineProperty(realmConstructor, 'Worker', {value: nodeRequire('./worker')}); Object.defineProperty(realmConstructor, 'Worker', {value: nodeRequire('./worker')});
} }
}
} }
module.exports = realmConstructor; module.exports = realmConstructor;