Merge pull request #115 from realm/sk-fix-chrome-tests

Re-enable chrome tests
This commit is contained in:
Scott Kyle 2015-11-02 17:00:11 -08:00
commit 8cb7e43e2e
3 changed files with 18 additions and 24 deletions

View File

@ -6,7 +6,7 @@
"start": "node_modules/react-native/packager/packager.sh"
},
"dependencies": {
"react-native": "0.13.0-rc",
"react-native": "0.13.2",
"realm": "file:../../lib"
}
}

View File

@ -12,9 +12,6 @@
extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack);
@interface RCTDevMenu () <RCTInvalidating>
@end
@interface RealmReactTests : RealmJSTests
@end
@ -23,6 +20,12 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
@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 {
return NSClassFromString(@"RCTContextExecutor");
}
@ -34,8 +37,7 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
+ (id<RCTJavaScriptExecutor>)currentExecutor {
Class executorClass = [self executorClass];
if (!executorClass) {
NSLog(@"%@: Executor class not found", self);
exit(1);
return nil;
}
static RCTBridge *s_bridge;
@ -44,20 +46,9 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
}
if (!s_bridge.valid) {
NSNotification *notification = [self waitForNotification:RCTDidCreateNativeModules];
s_bridge = notification.object;
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];
NSNotification *notification = [self waitForNotification:RCTJavaScriptDidLoadNotification];
s_bridge = notification.userInfo[@"bridge"];
assert(s_bridge);
}
if (s_bridge.executorClass != executorClass) {
@ -74,8 +65,14 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
}
+ (XCTestSuite *)defaultTestSuite {
XCTestSuite *suite = [super defaultTestSuite];
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!
JSGlobalContextRef ctx = RealmReactGetJSGlobalContextForExecutor(executor, false);
if (ctx) {
@ -99,7 +96,6 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
testCaseNames = renamedTestCaseNames;
}
XCTestSuite *suite = [super defaultTestSuite];
for (XCTestSuite *testSuite in [self testSuitesFromDictionary:testCaseNames]) {
[suite addTest:testSuite];
}
@ -184,7 +180,6 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
@end
/* TODO: Re-enable once this works in CI
@implementation RealmReactChromeTests
+ (Class)executorClass {
@ -196,4 +191,3 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
}
@end
*/

View File

@ -6,7 +6,7 @@
"start": "node_modules/react-native/packager/packager.sh"
},
"dependencies": {
"react-native": "^0.13.0-rc",
"react-native": "0.13.2",
"realm": "file:../../lib",
"realm-tests": "file:.."
}