rimraf
rimraf

Reputation: 4126

TypeError: _firebase2.default.storage is not a function (Jest test failure)

I have a simple shallow test.

import React from 'react';
import { shallow } from 'enzyme';
import Layout from '../containers/'

it('renders without crashing', () => {
  shallow(<Layout />);
});

Upon adding firebase.storage() functionality to my app (not in Layout.jsx directly but in the child of children of Layout) - i am now failing this simple test. I was under the impression that a shallow render here would be... well, shallow... no?

It should be noted that all of my firebase components work just fine and i'm not getting any errors anywhere other than this failing test.

I have tried bringing in import 'firebase/storage' but this doesn't work. Ideas?

Upvotes: 2

Views: 281

Answers (1)

Wellington Oliveira
Wellington Oliveira

Reputation: 31

I overwrote the test script in package.json to react-scripts test --env=jsdom --browser and it worked.

Upvotes: 3

Related Questions