执行赛普拉斯测试时
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;
});
});
有关产品的源代码
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>
)
}
}
和productlib
import React from 'react'
export default class Product extends React.Component { }
然后我在赛普拉斯中得到以下错误 错误:无法从>'/ Users / stein / node_modules / parse5 / lib / tokenizer'
中找到模块'./preprocessor'如何解决此错误?