我们的项目同时具有enzyme
和testing-library
。我的目标是将getByTestId覆盖到我的自定义中。但是,当我将第二个配置添加到我的 setup.test.js 时,一些测试会因Found multiple elements with the text
.
setup.test.js:
const { configure } = require("enzyme");
const Adapter = require("enzyme-adapter-react-16");
import { configure as conf } from "@testing-library/react";
window.__config = {};
conf({ testIdAttribute: "data-my-test-id" });
configure({ adapter: new Adapter() });
我的版本:
“酶”:“^3.11.0”,
"@testing-library/react": "^11.0.4",