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

karma-webpack-with-fast-source-maps

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-webpack-with-fast-source-maps

Use webpack with karma and fast, file source maps

  • 1.10.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98
decreased by-64.1%
Maintainers
1
Weekly downloads
 
Created
Source

karma-webpack-with-fast-source-maps

This is a fork of karma-webpack which enables file source maps and hot testing

Installation

npm install --save-dev karma-webpack-with-fast-source-maps

Usage

    // in karma.conf.js

		files: [
			// only specify one entry point
			// and require all tests in there
			'test/test_index.js'
		],

		preprocessors: {
			// add webpack as preprocessor
			'test/test_index.js': ['webpack']
		},
// test/test_index.js

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

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

function inManifest(path) {
  return __karmaWebpackManifest__.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);

Every test file is required using the require.context and compiled with webpack into one test bundle. When a file changes, only the affected tests will be run. If a failure occurs, the failing group will be rerun each run until they pass. If no tests are affected by a change, all tests are rerun (if you touch your test_index.js it will run all tests).

Source Maps

File (Faster)

File source maps are faster and work out of the box. Use:

webpack: {
  // ...
	devtool: 'cheap-module-source-map'
}

Inline

Or, if you want inline source maps, you can use the karma-sourcemap-loader:

npm install --save-dev karma-sourcemap-loader

And then add it to your preprocessors

preprocessors: {
	'test/test_index.js': ['webpack', 'sourcemap']
}

And tell webpack to generate sourcemaps

webpack: {
  // ...
	devtool: 'inline-source-map'
}

Options

This is the full list of options you can specify in your Karma config.

webpack

Webpack configuration.

webpackMiddleware

Configuration for webpack-dev-middleware.

License

Copyright 2014-2015 Tobias Koppers

MIT

FAQs

Package last updated on 15 Aug 2017

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