Test suite failed to run. Invariant Violation: _registerComponent(...): Target container is not a DOM element

The file you're testing, app.js, is attempting to find a DOM element with ID helloWorldRoot in the last line. This DOM element does not exist when the element is being rendered by Enzyme - hence the error message.

To fix this, separate the <App /> component and rendering of it into two files. Make sure the file that mounts the application to the DOM (let's call it main.js) does just this one thing and nothing else. The other file, app.js, can then be tested using Jest and Enzyme.

So main.js should do no more than:

import React from 'react';
import { render } from 'react-dom';
import App from './app';

render(<App/>, document.getElementById('helloWorldRoot'));

And of course the corresponding lines should be removed from app.js.