node package manager

mocha-loader

mocha loader module for webpack

mocha loader for webpack

Hint: when using ! in the bash command line, you must escape it by prepending a \

webpack-dev-server 'mocha!./my-client-tests.js' --options webpackOptions.js
enhanced-require 'mocha!./my-server-tests.js'
 
module.exports = {
    entry: './entry-file.js',
    output: {
        path: __dirname,
        filename: 'bundle.js'
    }
}

entry-file.js

/*additional setup with other loaders (polyfills, ...)*/
const context = require.context(/*directory*/'mocha!./tests', /*recursive*/true, /*match files*//_test.js$/);
context.keys().forEach(context);

MIT (http://www.opensource.org/licenses/mit-license.php)