How can the test directory be excluded from webpack packaging?

webpack.config.js

const nodeExternals = require('webpack-node-externals');
const webpack = require('webpack');
const path = require('path');

module.exports = {
  entry: './handler.js',
  target: 'node',
  externals: [nodeExternals()],
  plugins: [
    new webpack.IgnorePlugin(/\.(md|yml.encrypted|sh|vm)$/)
  ],
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: "babel-loader"
      },
      { 
        test: /\.json$/,
        loader: "json-loader"
      },
      {
        test: /\.yml$/,
        loader: "yml"
      }
    ]
  }
};

I’d like to exclude node_modules, test, scripts, bin directories.