Categories
Development

jest failing with “Target container is not a DOM element.” cause it tests my index.tsx

So i want to set up testing on a react project i working on. i set up some test files, but jest always fails with Test suite failed to run Target container is not a DOM element. 4 | import App from ‘~/App’; 5 | > 6 | ReactDOM.render(<App />, document.getElementById(‘root’)); | ^ 7 | […]

Categories
Development

“Navbar refers to a value, but is being used as a type here” when trying to render a shallow copy of my component when testing

I am trying to write a test to my React component, using TypeScript, Jest as my test runner and Enzyme for testing my React components. Whenever I pass my component into the shallow Enzyme function, I get the ts error “‘Navbar’ refers to a value, but is being used as a type here.”, and underneath […]