mercredi 11 mars 2020

How fix error "Jest encountered an unexpected token" with Jest and Enzyme?

I'm using create react app with jest and enzyme . Without enzyme tests, jest tests works fine. As soon as I run test with enzyme it throws an error "Jest encountered an unexpected token". Could please help me with that.

Here is full error message:

enter image description here

my test with enzyme :

import React from 'react';
import { shallow } from 'enzyme';
import Kassa24 from '../index';
import HeaderBlock from '../HeaderBlock';

test('check component is loaded', () => {
  const wrapped = shallow(<Kassa24 />);

  expect(wrapped.find(HeaderBlock).length).toEqual(1);
});

Aucun commentaire:

Enregistrer un commentaire