如何解决如何在setup.test.js中结合酶和反应测试库的配置
我们的项目同时具有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”,
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。