Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karma-bro

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-bro

A fast browserify integration for Karma that can easily handle large browserify projects

  • 0.2.2
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

karma-bro

Build Status

Bro is a fast browserify integration for Karma that handles large projects with ease.

Features

Bro is a preprocessor for Karma that combines test files and dependencies into a browserified bundle before tests get executed. It relies on watchify to generate the bundle and to keep it updated during autoWatch=true.

Some important features are

  • it builds one browserify bundle only
  • it incrementally updates the browserify bundle once tests and/or source files
  • it ensures tests are only once per test run

Installation

Get the plug-in via npm

npm install --save-dev karma-bro

Usage

Add browserify as the first framework used in your Karma configuration file. For each file that should be processed and bundled by karma, configure the browserify preprocessor. Optionally use the browserify config entry to configure how the bundle gets created.

module.exports = function(karma) {
  karma.set({

    frameworks: [ 'browserify', 'any', 'other', 'framework' ],

    preprocessors: {
      'test/**/*.js': [ 'browserify' ]
    },

    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    }
  });
}

Look at the example directory for a simple browserify + jasmine project that uses this plug-in.

Configure Browserify

The way Bro creates browserified test bundles can be tuned through the browserify configuration property. The following configuration options are supported:

  • extensions
  • builtins
  • basedir
  • commondir
  • resolve
  • transform

To generate source maps for easier debugging specify debug: true as an additional configuration option.

Detailed Configuration

The following code snippet shows a Karma configuration file with all karma-bro related options.

module.exports = function(karma) {
  karma.set({

    // include browserify first in used frameworks
    frameworks: [ 'browserify', 'jasmine' ],

    // add all your files here
    files: [
      'test/**/*.js'
    ],

    // add preprocessor to the files that should be
    // processed via browserify
    preprocessors: {
      'test/**/*.js': [ 'browserify' ]
    },

    // see what is going on
    logLevel: 'LOG_DEBUG',

    // use autoWatch=true for quick and easy test re-execution once files change
    autoWatch: true,

    // add additional browserify configuration properties here
    // such as transform and/or debug=true to generate source maps
    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    }
  });
};

Credit goes to to karma-browserify and karma-browserifast. Bro builds on the lessons learned in these projects and offers improved configurability, speed and/or the ability to handle large projects.

License

MIT

Keywords

FAQs

Package last updated on 01 May 2014

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