Я создал приложение реагирования с использованием create-Reaction-app, и я пытаюсь использовать фермент для простого теста простого компонента.
Header.test.js:
import Header from './Header';
import { shallow } from 'enzyme';
describe('Header component', () => {
it('renders correctly', () => {
const wrapper = shallow(<Header />);
expect(wrapper.exists()).toBe(true);
});
});
К сожалению, я продолжаю получать эту ошибку:
Cannot find module 'entities/maps/xml.json' from 'Tokenizer.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
at Object.<anonymous> (node_modules/cheerio/node_modules/htmlparser2/lib/Tokenizer.js:6:17)
Я догадываюсь, что это как-то связано с веб-пакетом, но я не уверен ... помогите!
О даи это мой пакет. json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"@fortawesome/react-fontawesome": "^0.1.3",
"bootstrap": "^4.1.3",
"http-proxy-middleware": "^0.19.0",
"react": "^16.6.1",
"react-dom": "^16.6.1",
"react-redux": "^5.1.1",
"react-scripts": "2.1.1",
"react-test-renderer": "^16.6.1",
"reactstrap": "^6.5.0",
"redux": "^4.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"babel": {
"presets": [
"react-app"
]
},
"devDependencies": {
"babel": "^6.23.0",
"babel-preset-react-app": "^6.1.0",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"enzyme-to-json": "^3.3.4",
"redux-devtools": "^3.4.1"
}
}