React testing setup with rails/webpacker : <p>I've added <a href="https://github.com/rails/webpacker" rel="noreferrer">webpacker</a> to my existing rails app, everything is working like a charm.</p>

<p>Webpack config is found under</p>

<pre><code>config/webpack/shared.js
config/webpack/development.js
config/webpack/production.js
</code></pre>

<p>node_modules are installed in</p>

<pre><code>vendor/node_modules
</code></pre>

<p>js pack files are in</p>

<pre><code>app/javascript/packs/application.js
</code></pre>

<p>I've installed react and wrote a little component:</p>

<pre><code>app/javascript/discover/example.jsx
</code></pre>

<p>Now I struggle with how to setup a working test environment. Normally I'd say the usual test setup should include: <code>karma</code>, <code>jasmine</code> or <code>mocha</code>, <code>webpack</code>.</p>

<p>Where should the config files live? Where will the test files be stored and to build a <code>karma.config.js</code> to bundle everything together.</p>

<p>It would be great to have a sample application that shows how to do all that correctly, but I obviously lack the necessary skills to plug everything together correctly.</p>

<p>This is not an easy to answer question, but having such an example application would be extremely helpful to a lot of people that'd want to use webpacker in the future.</p>

<p>Thanks for any thoughts on that topic,<br>
Jo</p>

<p><strong>Some helpful resources:</strong></p>

<ol>
<li><a href="https://medium.com/@scbarrus/how-to-get-test-coverage-on-react-with-karma-babel-and-webpack-c9273d805063#.g6p5go9gd" rel="noreferrer">https://medium.com/@scbarrus/how-to-get-test-coverage-on-react-with-karma-babel-and-webpack-c9273d805063#.g6p5go9gd</a></li>
<li><a href="http://qiita.com/kimagure/items/f2d8d53504e922fe3c5c" rel="noreferrer">http://qiita.com/kimagure/items/f2d8d53504e922fe3c5c</a></li>
<li><a href="http://nicolasgallagher.com/how-to-test-react-components-karma-webpack/" rel="noreferrer">http://nicolasgallagher.com/how-to-test-react-components-karma-webpack/</a></li>
<li><a href="https://www.codementor.io/reactjs/tutorial/test-reactjs-components-karma-webpack" rel="noreferrer">https://www.codementor.io/reactjs/tutorial/test-reactjs-components-karma-webpack</a></li>
</ol>
