lundi 16 novembre 2020

TypeError: Cannot read property 'default' of undefined while using JEST

Trying to write a jest test for a react native app, which has a wrapper with react context. On running jest for the base App.js screen. Getting the following error

** Test suite failed to run

TypeError: Cannot read property 'default' of undefined 

**

import React, { Component } from 'react';
    
    const SampleContext = React.createContext();

The error is shown to be at the above line. This SampleContext is a wrapper to pass down the context to children. Any suggestions or help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire