Skip to content

Commit

Permalink
fix: make Jest fake timers check more robust to other libs that overw…
Browse files Browse the repository at this point in the history
…rite time functions

Fix #12514
  • Loading branch information
vkarpov15 committed Oct 5, 2022
1 parent 140524c commit 2f22919
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers/printJestWarning.js
Expand Up @@ -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: ' +
Expand Down

0 comments on commit 2f22919

Please sign in to comment.