New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mocha-webpack

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-webpack

mocha cli with webpack support

  • 0.0.1-alpha.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
decreased by-44.01%
Maintainers
1
Weekly downloads
 
Created
Source

mocha-webpack npm package

Precompiles your server-side webpack bundles before running mocha. Inspired by karma-webpack alternatives usage, but this is for NodeJS!

Looking for a test runner for the browser? Use karma-webpack instead.

Status

Work in progress...

Features

  • easy testing of webpack code in node with mocha
  • reruns modified tests on file change

Usage

mocha-webpack --webpack-config webpack.config-test.js --watch --colors test_index.js

// webpack.config-test.js
var nodeExternals = require('webpack-node-externals');

module.exports = {
  target: 'node', // in order to ignore built-in modules like path, fs, etc.
  externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
  devtool: "#source-map"
};

// test_index.js

// This gets replaced by webpack with the updated files on rebuild
var __webpackManifest__ = [];

// require all modules ending in ".test" from the
// src directory and all subdirectories
var testsContext = require.context("./src", true, /\.test$/);

function inManifest(path) {
  return __webpackManifest__.indexOf(path) >= 0;
}

var runnable = testsContext.keys().filter(inManifest);

// // Run all tests if we didn't find any changes
if (!runnable.length) {
  runnable = testsContext.keys();
}

runnable.forEach(testsContext);

CLI options

TODO

Keywords

FAQs

Package last updated on 14 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc