diff --git a/lib/helpers/printJestWarning.js b/lib/helpers/printJestWarning.js index 7cef461adb7..2d9330b52c6 100644 --- a/lib/helpers/printJestWarning.js +++ b/lib/helpers/printJestWarning.js @@ -9,7 +9,7 @@ if (typeof jest !== 'undefined' && typeof window !== 'undefined') { 'https://mongoosejs.com/docs/jest.html'); } -if (typeof jest !== 'undefined' && process.nextTick.toString().indexOf('nextTick') === -1) { +if (typeof jest !== 'undefined' && setTimeout.clock != null && typeof setTimeout.clock.Date === 'function') { utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' + 'with Jest\'s mock timers enabled. Please make sure you read ' + 'Mongoose\'s docs on configuring Jest to test Node.js apps: ' +