mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-23 04:49:33 +00:00
Merge pull request #115 from realm/sk-fix-chrome-tests
Re-enable chrome tests
This commit is contained in:
commit
8cb7e43e2e
@ -6,7 +6,7 @@
|
|||||||
"start": "node_modules/react-native/packager/packager.sh"
|
"start": "node_modules/react-native/packager/packager.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-native": "0.13.0-rc",
|
"react-native": "0.13.2",
|
||||||
"realm": "file:../../lib"
|
"realm": "file:../../lib"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
|
|
||||||
extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack);
|
extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack);
|
||||||
|
|
||||||
@interface RCTDevMenu () <RCTInvalidating>
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface RealmReactTests : RealmJSTests
|
@interface RealmReactTests : RealmJSTests
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -23,6 +20,12 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
|
|
||||||
@implementation RealmReactTests
|
@implementation RealmReactTests
|
||||||
|
|
||||||
|
+ (void)load {
|
||||||
|
// We don't want the RCTDevMenu from switching the executor class from underneath us.
|
||||||
|
IMP init = class_getMethodImplementation([NSObject class], @selector(init));
|
||||||
|
class_replaceMethod([RCTDevMenu class], @selector(init), init, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
+ (Class)executorClass {
|
+ (Class)executorClass {
|
||||||
return NSClassFromString(@"RCTContextExecutor");
|
return NSClassFromString(@"RCTContextExecutor");
|
||||||
}
|
}
|
||||||
@ -34,8 +37,7 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
+ (id<RCTJavaScriptExecutor>)currentExecutor {
|
+ (id<RCTJavaScriptExecutor>)currentExecutor {
|
||||||
Class executorClass = [self executorClass];
|
Class executorClass = [self executorClass];
|
||||||
if (!executorClass) {
|
if (!executorClass) {
|
||||||
NSLog(@"%@: Executor class not found", self);
|
return nil;
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RCTBridge *s_bridge;
|
static RCTBridge *s_bridge;
|
||||||
@ -44,20 +46,9 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!s_bridge.valid) {
|
if (!s_bridge.valid) {
|
||||||
NSNotification *notification = [self waitForNotification:RCTDidCreateNativeModules];
|
NSNotification *notification = [self waitForNotification:RCTJavaScriptDidLoadNotification];
|
||||||
s_bridge = notification.object;
|
s_bridge = notification.userInfo[@"bridge"];
|
||||||
|
assert(s_bridge);
|
||||||
if (!s_bridge) {
|
|
||||||
NSLog(@"No RCTBridge provided by RCTJavaScriptDidLoadNotification");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// We don't want the RCTDevMenu from switching the executor class from underneath us.
|
|
||||||
[s_bridge.devMenu invalidate];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[self waitForNotification:RCTJavaScriptDidLoadNotification];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_bridge.executorClass != executorClass) {
|
if (s_bridge.executorClass != executorClass) {
|
||||||
@ -74,8 +65,14 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (XCTestSuite *)defaultTestSuite {
|
+ (XCTestSuite *)defaultTestSuite {
|
||||||
|
XCTestSuite *suite = [super defaultTestSuite];
|
||||||
id<RCTJavaScriptExecutor> executor = [self currentExecutor];
|
id<RCTJavaScriptExecutor> executor = [self currentExecutor];
|
||||||
|
|
||||||
|
// The executor may be nil if the executorClass was not found (i.e. release build).
|
||||||
|
if (!executor) {
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Remove this nonsense once the crashes go away when a test fails!
|
// FIXME: Remove this nonsense once the crashes go away when a test fails!
|
||||||
JSGlobalContextRef ctx = RealmReactGetJSGlobalContextForExecutor(executor, false);
|
JSGlobalContextRef ctx = RealmReactGetJSGlobalContextForExecutor(executor, false);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
@ -99,7 +96,6 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
testCaseNames = renamedTestCaseNames;
|
testCaseNames = renamedTestCaseNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTestSuite *suite = [super defaultTestSuite];
|
|
||||||
for (XCTestSuite *testSuite in [self testSuitesFromDictionary:testCaseNames]) {
|
for (XCTestSuite *testSuite in [self testSuitesFromDictionary:testCaseNames]) {
|
||||||
[suite addTest:testSuite];
|
[suite addTest:testSuite];
|
||||||
}
|
}
|
||||||
@ -184,7 +180,6 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* TODO: Re-enable once this works in CI
|
|
||||||
@implementation RealmReactChromeTests
|
@implementation RealmReactChromeTests
|
||||||
|
|
||||||
+ (Class)executorClass {
|
+ (Class)executorClass {
|
||||||
@ -196,4 +191,3 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
*/
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"start": "node_modules/react-native/packager/packager.sh"
|
"start": "node_modules/react-native/packager/packager.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-native": "^0.13.0-rc",
|
"react-native": "0.13.2",
|
||||||
"realm": "file:../../lib",
|
"realm": "file:../../lib",
|
||||||
"realm-tests": "file:.."
|
"realm-tests": "file:.."
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user