0.2.2 • Published 10 years ago

karma-amdwrap-preprocessor v0.2.2

Weekly downloads
49
License
ISC
Repository
github
Last release
10 years ago

karma-amdwrap-preprocessor

Karma preprocessor running amd-wrap on the code.

Installation

$ npm install karma-amdwrap-preprocessor --save-dev

Configuration

// karma.conf.js
module.exports = function(config){

  config.set({
    files: [
      'cjs/**/*.js'
    ],
    preprocessors: {
      'cjs/**/*.js': ['amdwrap']
    }
  });
};

Excluding files

You can exclude particular files from being wrapped by supplying an exclude function in the config:

amdwrapPreprocessor: {
  exclude: function(file){
    // return true to exclude
  }
}

The function is passed the karma file object.

Example

With the following source:

var foo = require('foo');
exports.bar = foo('bar');

The browser will be served:

define(function(require, exports, module){var foo = require('foo');
exports.bar = foo('bar');
});