{
  "name": "karma-babel-preprocessor",
  "version": "6.0.1",
  "description": "Preprocessor to compile ES6 on the fly with babel.",
  "homepage": "https://github.com/babel/karma-babel-preprocessor",
  "bugs": {
    "url": "https://github.com/babel/karma-babel-preprocessor/issues"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/babel/karma-babel-preprocessor.git"
  },
  "main": "lib/index.js",
  "keywords": [
    "karma-plugin",
    "karma-preprocessor",
    "babel",
    "6to5",
    "es6",
    "es2015"
  ],
  "scripts": {
    "test": "karma start"
  },
  "author": {
    "name": "Shuhei Kagawa",
    "email": "shuhei.kagawa@gmail.com"
  },
  "license": "ISC",
  "dependencies": {
    "babel-core": "^6.0.0"
  },
  "devDependencies": {
    "babel-polyfill": "^6.0.2",
    "babel-preset-es2015": "^6.0.12",
    "jasmine-core": "^2.3.4",
    "karma": "^0.13.14",
    "karma-jasmine": "^0.3.6",
    "karma-phantomjs-launcher": "^0.2.1",
    "phantomjs": "^1.9.18"
  },
  "readme": "[![build status](https://img.shields.io/travis/babel/karma-babel-preprocessor.svg)](https://travis-ci.org/babel/karma-babel-preprocessor)\n[![npm version](https://img.shields.io/npm/v/karma-babel-preprocessor.svg)](https://www.npmjs.org/package/karma-babel-preprocessor)\n[![npm downloads](https://img.shields.io/npm/dm/karma-babel-preprocessor.svg)](https://www.npmjs.org/package/karma-babel-preprocessor)\n\n# karma-babel-preprocessor\n\n> Preprocessor to compile ES6 on the fly with [babel](https://github.com/6to5/babel).\n\n**babel and karma-babel-preprocessor only convert ES6 modules to CommonJS/AMD/SystemJS/UMD. If you choose CommonJS, you still need to resolve and concatenate CommonJS modules on your own. We recommend [karma-browserify](https://github.com/Nikku/karma-browserify) + [babelify](https://github.com/babel/babelify) or [webpack](https://github.com/webpack/karma-webpack) + [babel-loader](https://github.com/babel/babel-loader) in such cases.**\n\n## Installation\n\n```bash\nnpm install karma-babel-preprocessor --save-dev\n```\n\nAs of Babel 6.0, [you need to tell Babel which features to use](http://babeljs.io/docs/plugins/). [babel-preset-es2015](http://babeljs.io/docs/plugins/preset-es2015/) would be the most common one.\n\n```bash\nnpm install babel-preset-es2015 --save-dev\n```\n\n## Configuration\n\nSee [babel options](https://babeljs.io/docs/usage/options) for more details.\n\nGiven `options` properties are passed to babel.\n\nIn addition to the `options` property, you can configure any babel options with function properties. This is useful when you want to give different babel options from file to file.\n\nFor example, inline sourcemap configuration would look like the following.\n\n```js\nmodule.exports = function (config) {\n  config.set({\n    preprocessors: {\n      'src/**/*.js': ['babel'],\n      'test/**/*.js': ['babel']\n    },\n    babelPreprocessor: {\n      options: {\n        presets: ['es2015'],\n        sourceMap: 'inline'\n      },\n      filename: function (file) {\n        return file.originalPath.replace(/\\.js$/, '.es5.js');\n      },\n      sourceFileName: function (file) {\n        return file.originalPath;\n      }\n    }\n  });\n};\n```\n\n### Don't preprocess third-party libraries\n\nThird-party libraries may not work properly if you apply `karma-babel-preprocessor` to them. It also introduces unnecessary overhead. Make sure to explicitly specify files that you want to preprocess.\n\nOK:\n\n```js\nmodule.exports = function (config) {\n  config.set({\n    preprocessors: {\n      'src/**/*.js': ['babel'],\n      'test/**/*.js': ['babel']\n    },\n    // ...\n  });\n};\n```\n\nNG:\n\n```js\nmodule.exports = function (config) {\n  config.set({\n    preprocessors: {\n      './**/*.js': ['babel']\n    },\n    // ...\n  });\n};\n```\n\nBecause it preprocesses files in `node_modules` and may break third-party libraries like jasmine #18.\n\n### Polyfill\n\nIf you need [polyfill](https://babeljs.io/docs/usage/polyfill/), make sure to include it in `files`.\n\n```bash\nnpm install babel-polyfill --save-dev\n```\n\n```js\nmodule.exports = function (config) {\n  config.set({\n    files: [\n      'node_modules/babel-polyfill/dist/polyfill.js',\n      // ...\n    ],\n    // ...\n  });\n});\n```\n\n### Karma's plugins option\n\nIn most cases, you don't need to explicitly specify `plugins` option. By default, Karma loads all sibling NPM modules which have a name starting with karma-*. If need to do so for some reason, make sure to include `'karma-babel-preprocessor'` in it.\n\n```js\nmodule.exports = function (config) {\n  config.set({\n    plugins: [\n     'karma-jasmine',\n     'karma-chrome-launcher',\n     'karma-babel-preprocessor'\n    ],\n    // ...\n  });\n};\n```\n\n## Custom preprocessor\n\nkarma-babel-preprocessor supports custom preprocessor. Set `base: 'babel'` in addition to normal preprocessor config.\n\n```js\nmodule.exports = function (config) {\n  config.set({\n    preprocessors: {\n      'src/**/*.js': ['babelSourceMap'],\n      'test/**/*.js': ['babelSourceMap']\n    },\n    customPreprocessors: {\n      babelSourceMap: {\n        base: 'babel',\n        options: {\n          presets: ['es2015'],\n          sourceMap: 'inline'\n        },\n        filename: function (file) {\n          return file.originalPath.replace(/\\.js$/, '.es5.js');\n        },\n        sourceFileName: function (file) {\n          return file.originalPath;\n        }\n      },\n      // Other custom preprocessors...\n    }\n  });\n};\n```\n",
  "readmeFilename": "README.md",
  "_id": "karma-babel-preprocessor@6.0.1",
  "dist": {
    "shasum": "ab5f01c686a735f234174440a0c34e3a544c54ef"
  },
  "_from": "karma-babel-preprocessor@^6.0.1",
  "_resolved": "https://registry.npmjs.org/karma-babel-preprocessor/-/karma-babel-preprocessor-6.0.1.tgz"
}
