karma-amdwrap-preprocessor

0.2.2 • Public • Published

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');
});

Package Sidebar

Install

npm i karma-amdwrap-preprocessor

Weekly Downloads

233

Version

0.2.2

License

ISC

Last publish

Collaborators

  • davetayls