mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Migrate Utilities/infoLog, Utilities/logError, Utilities/mapWithSeparator & Utilities/warnOnce to use export syntax (#49406)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49406 ## Motivation Modernising the RN codebase to allow for modern Flow tooling to process it. ## This diff - Migrates Utilities/infoLog, Utilities/logError, Utilities/mapWithSeparator & Utilities/warnOnce to use the export syntax. - Updates deep-imports of these files to use `.default` - Updates the current iteration of API snapshots (intended). Changelog: [General][Breaking] - Deep imports to `Utilities/infoLog`, `Utilities/logError`, `Utilities/mapWithSeparator` or `Utilities/warnOnce` with `require` syntax need to be appended with '.default'. Reviewed By: huntie Differential Revision: D69601174 fbshipit-source-id: 821f9ae59d4f898c95631eb7a9aeed138ace3567
This commit is contained in:
1 parent
152587cda0
commit
7aef81b984
16 files changed
+20
-19
No files matched your search
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('infoLog', () => {
|
||||
const infoLog = require('../infoLog');
|
||||
const infoLog = require('../infoLog').default;
|
||||
|
||||
it('logs messages to the console', () => {
|
||||
console.log = jest.fn();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('logError', () => {
|
||||
const logError = require('../logError');
|
||||
const logError = require('../logError').default;
|
||||
|
||||
it('logs error messages to the console', () => {
|
||||
console.error.apply = jest.fn();
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('mapWithSeparator', () => {
|
||||
const mapWithSeparator = require('../mapWithSeparator');
|
||||
const mapWithSeparator = require('../mapWithSeparator').default;
|
||||
|
||||
it('mapWithSeparator returns expected results', () => {
|
||||
const array = [1, 2, 3];
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('warnOnce', () => {
|
||||
const warnOnce = require('../warnOnce');
|
||||
const warnOnce = require('../warnOnce').default;
|
||||
|
||||
it('logs warning messages to the console exactly once', () => {
|
||||
jest.spyOn(console, 'warn').mockReturnValue(undefined);
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@ function infoLog(...args: Array<mixed>): void {
|
||||
return console.log(...args);
|
||||
}
|
||||
|
||||
module.exports = infoLog;
|
||||
export default infoLog;
|
||||
+1
-1
@@ -24,4 +24,4 @@ const logError = function (...args: $ReadOnlyArray<mixed>) {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = logError;
|
||||
export default logError;
|
||||
@@ -25,4 +25,4 @@ function mapWithSeparator<TFrom, TTo>(
|
||||
return mapped;
|
||||
}
|
||||
|
||||
module.exports = mapWithSeparator;
|
||||
export default mapWithSeparator;
|
||||
+1
-1
@@ -29,4 +29,4 @@ function warnOnce(key: string, message: string) {
|
||||
warnedKeys[key] = true;
|
||||
}
|
||||
|
||||
module.exports = warnOnce;
|
||||
export default warnOnce;
|
||||
Reference in new issue
Block a user