如何在setup.test.js中结合酶和反应测试库的配置

问题描述

我们的项目同时具有enzymetesting-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 (将#修改为@)