Skip to content

Commit

Permalink
no longer detecting enumerable when add domain
Browse files Browse the repository at this point in the history
Considering we drop support for Node 8, this compromise can be removed.

jestjs#9136
  • Loading branch information
mapleeit authored Nov 24, 2020
1 parent ff2b65c commit 0c8a549
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions packages/jest-util/src/createProcessObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,12 @@ export default function (): NodeJS.Process {

newProcess.env = createProcessEnv();
newProcess.send = () => {};

const domainPropertyDescriptor = Object.getOwnPropertyDescriptor(
newProcess,
'domain',
);
if (domainPropertyDescriptor && !domainPropertyDescriptor.enumerable) {
Object.defineProperty(newProcess, 'domain', {
get() {
return process.domain;
},
});
}

Object.defineProperty(newProcess, 'domain', {
get() {
return process.domain;
},
});

return newProcess;
}

0 comments on commit 0c8a549

Please sign in to comment.