title: How to run unit test with webpack?
body: <p>I have a Node Js server that I bundled with webpack with the following config:</p>
  
  <pre><code>module.exports = {
      entry: './build/index.js',
      output: {
          filename: 'main.js',
          path: path.resolve(__dirname, 'dist'),
          devtoolModuleFilenameTemplate: '../[resource-path]',
      },
  
      target: 'node',
      node: {
          __dirname: true,
      },
      externals: {
          kcors: 'kcors',
          'koa-bodyparser': 'koa-bodyparser'
      },
      module: {
          rules: [
              {
                  test: /\.js$/,
                  use: ["source-map-loader"],
                  enforce: "pre"
              },
          ],
      },
      resolve: {
          extensions: ['.js'],
      },
      // plugins: [
      //     new webpack.DefinePlugin({
      //         "process.env": JSON.stringify(dotenv.parsed)
      //     }),
      // ],
      devtool: 'eval-source-map'
  };
  </code></pre>
  
  <p>This created a single file <code>main.js</code> inside <code>dist</code></p>
  
  <p>Everything looks good so far. I manually tested the server and it works.</p>
  
  <p>Now, before I used webpack, I have a set of unit tests that I named with the <code>.spec.js</code> suffix inside my entry folder (the <code>build/</code> folder) and each <code>.js</code> file has each own <code>.spec</code> file sibling located in the same directory of the <code>.js</code>. </p>
  
  <p>To run theses unit test, I used mocha with the command: <code>mocha build/**/*.spec.js --recursive --timeout 20000</code></p>
  
  <p>Since I am new to webpack and the concept of bundling, how do I run the same tests from the <code>main.js</code> file ? I want to make sure that all tests are still passing in the bundled file </p>