[![npm][npm]][npm-url] [![node][node]][node-url] [![deps][deps]][deps-url] [![tests][tests]][tests-url] [![chat][chat]][chat-url]
mocha loader module for webpack
This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.
To begin, you'll need to install mocha-loader
:
$ npm install mocha-loader --save-dev
Then add the loader to your webpack
config. For example:
// webpack.config.js module.exports = { entry: './entry.js', output: { path: __dirname, filename: 'bundle.js' }, module: { rules: [{ test: /test\.js$/, use: 'mocha-loader', exclude: /node_modules/, }] } }
Then import
the target file somewhere in your app:
// src/entry.js import test from './test'
And run webpack
via your preferred method.
You can also use the loader via:
webpack --module-bind 'mocha-loader!./test'
import test from 'mocha-loader!./test'
Please take a moment to read our contributing guidelines if you haven't yet done so.
© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/loaders/mocha-loader