I am using react-testing-library with jest-dom. It is working fine but when i try to use toBeInTheDocument
it throws the error 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
Error log:
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)