问题描述
我正在使用带有 jest-dom 的 react-testing-library。它工作正常,但当我尝试使用 toBeInTheDocument
时,它抛出错误 TypeError: element.getRootNode is not a function
。
expect(getByText('Not in dom')).not.toBeInTheDocument(); // It works
expect(getByText('Value in DOM')).toBeInTheDocument(); // It throws the error
错误日志:
TypeError: element.getRootNode is not a function
at Object.it (src/x/y/z.test.js:42:34)
at new Promise (<anonymous>)
at process._tickCallback (internal/process/next_tick.js:68:7)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)