diff --git a/packages/jest-util/src/isPromise.ts b/packages/jest-util/src/isPromise.ts index 5e77f9e2cf7a..07617e927a8b 100644 --- a/packages/jest-util/src/isPromise.ts +++ b/packages/jest-util/src/isPromise.ts @@ -5,6 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +// capture global.Promise before it may potentially be overwritten +const Promise = global.Promise; + // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 const isPromise = (candidate: unknown): candidate is Promise => Promise.resolve(candidate) === candidate;