mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41330 D41564032 made `console.log` (as well as `debug` and `info`) a noop in tests within the React Native repo. Here we allow them through while still throwing errors on `console.error` and `console.warn`. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D51002264 fbshipit-source-id: 44ca8bef38695dd76fe509341adced887bef2e6b
29 lines
687 B
JavaScript
29 lines
687 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
// Global setup for tests local to the react-native repo. This setup is not
|
|
// included in the react-native Jest preset.
|
|
|
|
'use strict';
|
|
|
|
require('./setup');
|
|
|
|
const consoleError = console.error;
|
|
const consoleWarn = console.warn;
|
|
|
|
console.error = (...args) => {
|
|
consoleError(...args);
|
|
throw new Error('console.error() was called (see error above)');
|
|
};
|
|
|
|
console.warn = (...args) => {
|
|
consoleWarn(...args);
|
|
throw new Error('console.warn() was called (see warning above)');
|
|
};
|