From a851e426d624bb0fd44be73c590742d541f5bf28 Mon Sep 17 00:00:00 2001 From: Dan Ristea Date: Fri, 21 Sep 2018 14:14:24 +0100 Subject: [PATCH] Check _isMockFunction is true rather than truthy Fixes #7009 --- CHANGELOG.md | 1 + packages/jest-runtime/src/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac023720d4e5..98946b1b1160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - `[jest-haste-map]` Fixed Haste whitelist generation for scoped modules on Windows ([#6980](https://github.com/facebook/jest/pull/6980)) - `[jest-mock]` Fix inheritance of static properties and methods in mocks ([#7003](https://github.com/facebook/jest/pull/7003)) - `[jest-mock]` Fix mocking objects without `Object.prototype` in their prototype chain ([#7003](https://github.com/facebook/jest/pull/7003)) +- `[jest-runtime]` Check `globalMock._isMockFunction` is true rather than truthy ([#7017](https://github.com/facebook/jest/pull/7017)) ### Chore & Maintenance diff --git a/packages/jest-runtime/src/index.js b/packages/jest-runtime/src/index.js index d6612eb42221..507da20aa247 100644 --- a/packages/jest-runtime/src/index.js +++ b/packages/jest-runtime/src/index.js @@ -430,7 +430,7 @@ class Runtime { (typeof globalMock === 'object' && globalMock !== null) || typeof globalMock === 'function' ) { - globalMock._isMockFunction && globalMock.mockClear(); + globalMock._isMockFunction === true && globalMock.mockClear(); } });