mocha-loader

mocha-loader

允许通过 webpack 加载和运行 Mocha 测试

安装

npm install --save-dev mocha-loader

用法

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/, }] } }

import test from './test'

CLI

webpack --module-bind 'mocha-loader!./test'

import test from './test'

要求

import test from 'mocha-loader!./test'

选项