Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Cannot convert undefined or null to object at assign (<anonymous>) #126

Closed
@alexwasner

Description

@alexwasner
  • react-native or expo: RN
  • native-testing-library version: 5.0.3
  • jest-preset: ^26.0.1
  • react-native version: 0.63.0-rc.1
  • node version: v12.0.0

Relevant code or config:

Repo with steps to reproduce

What you did:

Upon upgrading from React Native 0.62.2 to React Native 0.63.0-rc.1 (to pre-empt the upcoming release,) all of my tests broke.

What happened:

 FAIL  __tests__/App.test.tsx
  ✕ renders correctly (367 ms)

  ● renders correctly

    TypeError: Cannot convert undefined or null to object
        at assign (<anonymous>)

      at node_modules/@testing-library/react-native/dist/preset/mock-modules.js:41:3
      at Object.<anonymous> (node_modules/react-native/Libraries/Animated/src/AnimatedEvent.js:15:21)
      at Object.<anonymous> (node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:14:44)

The stack trace differs based on the component, but it is always Cannot convert undefined or null to object

Reproduction:

Clone this repo and run the tests.

If you change the jest.config.js to

  preset: 'react-native',
  setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],

the issue error is resolved

Problem description:

Tests fail. 🤷‍♂️

Suggested solution:

Can't dig into it too much atm

Can you help us fix this issue by submitting a pull request?

I'd love to, but other priorities with work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions