ayaniimi213
3/13/2015 - 7:44 AM

karma + mocha + browserify + babel + power-assert

karma + mocha + browserify + babel + power-assert

export default function sum(a, b) {
  return a + b;
}
import assert from 'power-assert';
import sum from './sum';

describe("sum", () => {
  it("2 + 2 = 5", () => {
    assert(sum(2, 2) === 5);
  });
});
{
  "name": "karma-conf",
  "version": "1.0.0",
  "description": "",
  "main": "karma.conf.js",
  "scripts": {
    "test": "karma start"
  },
  "browserify": {
    "transform": [
      [
        "babelify",
        {
          "presets": [
            "es2015"
          ]
        }
      ]
    ]
  },
  "repository": {
    "type": "git",
    "url": "git+https://gist.github.com/7a18677b583e1ec43fca.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://gist.github.com/7a18677b583e1ec43fca"
  },
  "homepage": "https://gist.github.com/7a18677b583e1ec43fca",
  "devDependencies": {
    "babel-plugin-espower": "^2.1.2",
    "babel-preset-es2015": "^6.6.0",
    "babelify": "^7.2.0",
    "browserify": "^13.0.0",
    "karma": "^0.13.22",
    "karma-browserify": "^5.0.3",
    "karma-chrome-launcher": "^0.2.3",
    "karma-mocha": "^0.2.2",
    "mocha": "^2.4.5",
    "power-assert": "^1.3.1",
    "watchify": "^3.7.0"
  }
}
// Karma configuration
// Generated on Thu Apr 07 2016 10:06:49 GMT+0900 (JST)

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

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['browserify', 'mocha'],

    browserify: {
      debug: true,
      transform: [
        ['babelify', {plugins: ['babel-plugin-espower']}]
      ]
    },

    // list of files / patterns to load in the browser
    files: [
      '*-test.js'
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      '*-test.js': 'browserify'
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}