import react from "react";import shallow from "enzyme";import application from "./App";it("App", () => const application = shallow(App />); expect(1).toEqual(1););The relative component it"s picking up is :

import React, ingredient native "react";import render indigenous "react-dom";// import "./styles/normalize.css";class application extends ingredient render() return ( div>appdiv> ); render(App />, document.getElementById("app"));However, running jest causes a failure:

Invariant Violation: _registerComponent(...): Target container is not a DOM element.

With errors

at Object. (src/App.js:14:48)at Object. (src/App.test.js:4:38)

The test files references heat 4, i m sorry is the income of , that causes a fail. The ridge trace claims line 14 of App.js is the reason for the fail -- i beg your pardon is nothing an ext than the render contact from react-dom, other I"ve never had actually a difficulty with (the application renders effectively from my Webpack setup).

For those interested (Webpack code):

module.exports = entry: "./src/App", output: filename: "bundle.js", path: "./dist" , module: loaders: < test: /.js?$/, exclude: /node_modules/, loader: "babel", query: presets: <"react", "es2015"> , test: /.css$/, loader: "style!css-loader?modules&importLoaders=1&localIdentName=_____" , test: /.scss$/, loader: "style!css-loader?modules&importLoaders=1&localIdentName=_____!sass" > And my package.json:

"name": "tic-tac-dux", "version": "1.0.0", "description": "", "main": "index.js", "scripts": "dev": "webpack-dev-server --devtool eval --progress --colors --inline --hot --content-base dist/", "test": "jest" , "jest": "moduleNameMapper": "^.+\.(jpg , "keywords": <>, "author": "", "license": "ISC", "devDependencies": "babel-core": "^6.17.0", "babel-jest": "^16.0.0", "babel-loader": "^6.2.5", "babel-polyfill": "^6.16.0", "babel-preset-es2015": "^6.16.0", "babel-preset-react": "^6.16.0", "css-loader": "^0.25.0", "enzyme": "^2.4.1", "jest": "^16.0.1", "jest-cli": "^16.0.1", "node-sass": "^3.10.1", "react-addons-test-utils": "^15.3.2", "react-dom": "^15.3.2", "sass-loader": "^4.0.2", "style-loader": "^0.13.1", "webpack": "^1.13.2", "webpack-dev-server": "^1.16.2" , "dependencies": "react": "^15.3.2", "react-dom": "^15.3.2" Oh, and also if everyone is going to say that the div aspect isn"t gift loaded before the script, here"s mine index.html: