mocha-loader

mocha-loader

Allows Mocha tests to be loaded and run via webpack

Install

npm install --save-dev mocha-loader

Usage

webpack.config.js

module.exports = {
  entry: './entry.js',
  output: {
    path: __dirname,
    filename: 'bundle.js'
  },
  modules: {
    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'

Require

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

Options

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/loaders/mocha-loader

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部