App doesn't render in jest tests?

Please provide the following:

  1. SDK Version: 43
  2. Platforms(Android/iOS/web/all): all

I’m following the directions in the Testing with Jest expo docs to create a test that just renders the root of my app.

import React from 'react';
import renderer from 'react-test-renderer';

import App from './App';

describe('<App />', () => {
  it('has 1 child', () => {
    const tree = renderer.create(<App />).toJSON();

But I get an error because tree.children is null. This is weird, because the app works just fine.

When I created a snapshot, it looks like this:

// Jest Snapshot v1,

exports[`<App /> has 1 child 1`] = `
    Array [
      Object {
        "flex": 1,

Any idea what I’m doing wrong?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.