Skip to content

Commit

Permalink
fix for overwritten global.Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal committed Feb 10, 2019
1 parent 3ae4136 commit 48e4d52
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/jest-util/src/isPromise.ts
Expand Up @@ -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<unknown> =>
Promise.resolve(candidate) === candidate;
Expand Down

0 comments on commit 48e4d52

Please sign in to comment.