karma-react-preprocessor

[![Build Status](https://travis-ci.org/maksimr/karma-react-preprocessor.png?branch=master)](https://travis-ci.org/maksimr/karma-react-preprocessor)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
karma-react-preprocessor
800.0.48 years ago9 years agoMinified + gzip package size for karma-react-preprocessor in KB

Readme

karma-react-preprocessor
Build Status
Preprocessor for react jsx files

Installation

The easiest way is to keep karma-react-preprocessor as a devDependency in your package.json.
{
  "devDependencies": {
    "karma": "~0.10",
    "karma-react-preprocessor": "~0.1"
  }
}

You can simple do it by:
npm install karma-react-preprocessor --save-dev

Configuration

Following code shows the default configuration...
// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.jsx': ['react']
    }
  });
};

By default preprocessor transform extension from jsx to js. You can change it by:
// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.jsx': ['react']
    },
    reactPreprocessor: {
        transformPath: function(path) {
            return path.replace(/\.jsx$/, '.js');
        }
    }
  });
};

You can pass an options object that will be passed to react-tools module. See available options.
// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.jsx': ['react']
    },
    reactPreprocessor: {
        harmony: true,
        es6module: true
    }
  });
};

You can look at karma.conf.js how example
For more information on Karma see the homepage.