Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing Jest tests #4

Open
JPStrydom opened this issue Jul 31, 2018 · 2 comments
Open

Failing Jest tests #4

JPStrydom opened this issue Jul 31, 2018 · 2 comments

Comments

@JPStrydom
Copy link

Whenever I have this package imported in a file, Jest gives me the following error message for that file:

SyntaxError: Unexpected identifier

import React, { Component } from "react";
       ^^^^^

I tried adding it as a transform ignore pattern, but it didn't work.

Any idea how to fix t?

@GChin12
Copy link

GChin12 commented Jul 31, 2018

I am experiencing the same issue.

@JPStrydom
Copy link
Author

JPStrydom commented Jul 31, 2018

I managed to temporarily solve the issue by having the following in my jest-setup.js file:

import React from 'react';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });

jest.mock('react-crossfade-image', () => <div />);

This isn't an ideal solution, but it works for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants