A new approach was needed for this. The RCTDevMenu is disabled so that it doesn't interfere with us changing the executor class. A suffix is added to the name of test cases that are run in Chrome.
The key idea was the cycle the runloop once after receiving the RCTJavaScriptDidLoadNotification so that the RCTDevMenu could also handle that notification and setup the bridge properly, as well as not block the main thread by spinning the runloop instead.
This also appears to fix crashes when running ReactTests with Chrome debugging enabled!
The crash when tests failed was due to JavaScriptCore trying to create a backtrace with the native call stack.
The test structure is now provided by a JS API, that is used by all things that run tests. Also, the tests can be run manually by tapping a button in the ReactTests app.
The deleteTestFiles() function is now added to the Realm object, so that it's easy for the RPC module to handle this as well. We can only do this in testing environments in the future.