mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 00:23:26 +00:00
Codemod Internal Unit Tests and Remove Require Fallback
Summary: MessageQueue no longer falls back to require. To do this we need to register all the modules in our internal unit tests. I did this codemod manually. This is a bit unfortunate boilerplate but there are very few of these modules outside of unit tests. This boilerplate is only a hassle for these test files. public Reviewed By: spicyj Differential Revision: D2736397 fb-gh-sync-id: 59fa4c4e75c538f3577bc9693b93e1b7c4d4d233
This commit is contained in:
parent
b78b8f6cab
commit
ae912a83d7
@ -159,20 +159,11 @@ class MessageQueue {
|
|||||||
console.log('N->JS : ' + module + '.' + method + '(' + JSON.stringify(args) + ')');
|
console.log('N->JS : ' + module + '.' + method + '(' + JSON.stringify(args) + ')');
|
||||||
}
|
}
|
||||||
var moduleMethods = this._callableModules[module];
|
var moduleMethods = this._callableModules[module];
|
||||||
if (!moduleMethods) {
|
invariant(
|
||||||
// TODO: Register all the remaining test modules and make this an invariant. #9317773
|
!!moduleMethods,
|
||||||
// Fallback to require temporarily. A follow up diff will clean up the remaining
|
'Module %s is not a registered callable module.',
|
||||||
// modules and make this an invariant.
|
module
|
||||||
console.warn('Module is not registered:', module);
|
);
|
||||||
moduleMethods = require(module);
|
|
||||||
/*
|
|
||||||
invariant(
|
|
||||||
!!moduleMethods,
|
|
||||||
'Module %s is not a registered callable module.',
|
|
||||||
module
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
moduleMethods[method].apply(moduleMethods, args);
|
moduleMethods[method].apply(moduleMethods, args);
|
||||||
BridgeProfiling.profileEnd();
|
BridgeProfiling.profileEnd();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user