Я следовал инструкциям в других проектах и потоках, но не могу заставить React найти файл конфигурации Enzyme.
package.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js, jsx, mjs}"
],
"setupFiles": [
"<rootDir>src/setupTests.js"
]
}
src/setupTests.js
import Enzyme from "enzyme";
import Adapter from "enzyme-adapter-react-16";
export { shallow, render, mount } from "enzyme";
export { shallowToJson } from "enzyme-to-json";
Enzyme.configure({ adapter: new Adapter() });
export default Enzyme;
the error when running tests
Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none.
To configure an adapter, you should call `Enzyme.configure({ adapter: new Adapter() })`
before using any of Enzyme's top level APIs, where `Adapter` is the adapter
corresponding to the library currently being tested. For example:
import Adapter from 'enzyme-adapter-react-15';
Любая помощь будет высоко ценится. Спасибо