【发布时间】:2021-04-28 10:47:35
【问题描述】:
我在一个使用create-react-app 的项目中看到一个名为setupTest.js 的文件,它只导入@testing-library/jest-dom,并且测试似乎使用了扩展的expect 版本,例如.toBeInTheDocument。
我在我的项目中添加了相同的文件 (setupTest.js),但似乎没有效果。
换句话说,我怎样才能全局导入@testing-library/jest-dom 而不是在每个.spec.ts 文件中都这样做?
【问题讨论】:
标签: typescript jestjs react-testing-library testing-library