Docs Menu

Docs HomeRealm

Test & Debug - React Native SDK

On this page

  • Testing
  • Clean Up Tests
  • Debugging
  • Safari Developer Tools
  • Flipper
  • Chrome Developer Tools

You can test the Realm React Native SDK with popular React Native testing libraries like Jest, Jasmine, and Mocha.


See also:

When testing the Realm React Native SDK, you must close realms with Realm.close() after you're done with them to prevent memory leaks.

You should also delete the realm file with Realm.deleteFile() during clean up to keep your tests idempotent.

The below example uses the Jest testing framework. It uses Jest's built-in beforeEach() and afterEach() hooks for test set up and tear down, respectively.

const config = {
schema: [Car],
let realm;
beforeEach(async () => {
realm = await;
afterEach(() => {
if (!realm.isClosed) {
if (config) {
test("Close a Realm", async () => {

Realm provides differing levels of support for various React Native debuggers.

If you're a macOS user, you can use Safari Developer Tools to debug the iOS version of your React Native app with Realm.

To set up Safari Developer Tools with your React Native app, refer to the official documentation.

Flipper is a platform for debugging React Native apps. You can currently only only use Flipper with the Realm React Native SDK Hermes release. Hermes is a JavaScript engine optimized for React Native.

While Realm works with the Chrome Developer Tools on React Native, the debugger's performance degrades significantly when using it with Realm. This is due to the blocking nature of the RPC calls made by Realm.

If you are able, you should use the Safari Developer Tools or Flipper instead of the Chrome Developer Tools.

←  Bundle a Realm File - React Native SDKUpgrade from Stitch to Realm - React Native SDK →
Give Feedback
© 2022 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.