mocha-loader
mocha loader module for webpack
Requirements
This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.
Getting Started
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.
Examples
You can also use the loader via:
CLI
webpack --module-bind 'mocha-loader!./test'
Require
import test from 'mocha-loader!./test'
Contributing
Please take a moment to read our contributing guidelines if you haven't yet done so.