When I execute the cypress test
import React from 'react';
import ReactDOM from 'react-dom';
import { configure, shallow } from 'enzyme';
import { expect } from 'chai';
import ProcutList from '../../src/components/ProductList';
import Product from '../../src/components/Product'
import Adapter from 'enzyme-adapter-react-16'
configure({ adapter: new Adapter() });
describe('ProductList component testing', () => {
it('Should display one product in a productlist' , ()=> {
const wrapper = shallow(<ProductList />);
const item =wrapper.find('div[class="ui unstackable items"]');
const product = item.find('Product')
expect(product).to.exist;
});
});
For the source code of Product
import React from 'react'
export default class Product extends React.Component {
render () {
return (
<div className = 'item'>
<div className = 'image'>
<img src='./images/Banana-Snowboard.png' alt="Snow Board"/>
</div>
<div className = 'middel aligned content'>
<div className = 'description'>
<a>Snow Board</a>
<p>Cool Snow Board</p>
</div>
<div className = 'extra'>
<span>Submitted by:</span>
<img className = 'ui avatar image' src= './images/avatar.png' alt="Avatar" />
</div>
</div>
</div>
)
}
}
And the productlib
import React from 'react'
export default class Product extends React.Component { }
Then I get following error in Cypress Error: Cannot find module './preprocessor' from >'/Users/stein/node_modules/parse5/lib/tokenizer'
How do I fix this error?