Когда я выполняю тест кипариса
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 { }
Затем я получаю следующую ошибку в Cypress Error: Не удается найти модуль ./preprocessor 'from>' / Users / stein / node_modules / parse5 / lib / tokenizer '
Как исправить эту ошибку?
javascript,reactjs,enzyme,cypress,chai-enzyme,
Когда я выполняю тест кипариса
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 { }
00JavaScript, reactjs, фермент, кипарис, Chai-фермент,Затем я получаю следующую ошибку в Cypress Error: Не удается найти модуль ./preprocessor 'from>' / Users / stein / node_modules / parse5 / lib / tokenizer '
Как исправить эту ошибку?