|
2 | 2 |
|
3 | 3 | const utils = require('../utils');
|
4 | 4 |
|
5 |
| -if (typeof jest !== 'undefined' && typeof window !== 'undefined') { |
6 |
| - utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' + |
7 |
| - 'with Jest\'s default jsdom test environment. Please make sure you read ' + |
8 |
| - 'Mongoose\'s docs on configuring Jest to test Node.js apps: ' + |
9 |
| - 'https://mongoosejs.com/docs/jest.html'); |
10 |
| -} |
| 5 | +if (typeof jest !== 'undefined' && !process.env.SUPPRESS_JEST_WARNINGS) { |
| 6 | + if (typeof window !== 'undefined') { |
| 7 | + utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' + |
| 8 | + 'with Jest\'s default jsdom test environment. Please make sure you read ' + |
| 9 | + 'Mongoose\'s docs on configuring Jest to test Node.js apps: ' + |
| 10 | + 'https://mongoosejs.com/docs/jest.html. Set the SUPPRESS_JEST_WARNINGS to true ' + |
| 11 | + 'to hide this warning.'); |
| 12 | + } |
11 | 13 |
|
12 |
| -if (typeof jest !== 'undefined' && setTimeout.clock != null && typeof setTimeout.clock.Date === 'function') { |
13 |
| - utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' + |
14 |
| - 'with Jest\'s mock timers enabled. Please make sure you read ' + |
15 |
| - 'Mongoose\'s docs on configuring Jest to test Node.js apps: ' + |
16 |
| - 'https://mongoosejs.com/docs/jest.html'); |
| 14 | + if (setTimeout.clock != null && typeof setTimeout.clock.Date === 'function') { |
| 15 | + utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' + |
| 16 | + 'with Jest\'s mock timers enabled. Please make sure you read ' + |
| 17 | + 'Mongoose\'s docs on configuring Jest to test Node.js apps: ' + |
| 18 | + 'https://mongoosejs.com/docs/jest.html. Set the SUPPRESS_JEST_WARNINGS to true ' + |
| 19 | + 'to hide this warning.'); |
| 20 | + } |
17 | 21 | }
|
0 commit comments