目录
Webpack 2.2 中文文档
mocha-loader
用法
命令行
提示: 当需要在命令行输入”!”时, 你需要在其前面插入 \ 将其转义。
webpack-dev-server 'mocha!./my-client-tests.js' --options webpackOptions.js
enhanced-require 'mocha!./my-server-tests.js'
配置
webpack.config.js
module.exports = { entry: './entry-file.js', output: { path: __dirname, filename: 'bundle.js' } }
entry-file.js
/*与其他loader配合需要的额外配置 (polyfills, ...)*/ const context = require.context(/*目录*/'mocha-loader!./tests', /*循环*/true, /*符合条件的文件*//_test.js$/); context.keys().forEach(context);
License
MIT (http://www.opensource.org/licenses/mit-license.php)
原文:https://webpack.js.org/loaders/mocha-loader/
上一篇: less-loader 下一篇: multi-loader