Skip to content

Instantly share code, notes, and snippets.

@adamchenwei
Created October 26, 2016 15:21
Show Gist options
  • Save adamchenwei/6f32530f010f9c6509be04c8acc6bc10 to your computer and use it in GitHub Desktop.
Save adamchenwei/6f32530f010f9c6509be04c8acc6bc10 to your computer and use it in GitHub Desktop.
ES6 + Babel + Browserify + Mocha + Chai + Karma + Istanbul + PhantomJS
var istanbul = require('browserify-istanbul');
module.exports = function (config) {
config.set({
basePath: '../',
files: ['src/scripts/**/*.js', 'test/unit/**/*.js'],
frameworks: ['browserify', 'mocha', 'chai'],
browsers: ['PhantomJS'], // 'Chrome'
preprocessors: {
'src/scripts/**/*.js': ['browserify'],
'test/unit/**/*.js': ['browserify']
},
browserify: {
debug: true,
bundleDelay: 1000,
transform: [['babelify', {
ignore: /node_modules/
}], istanbul({
ignore: ['test/**', '**/node_modules/**']
})],
extensions: ['.js']
},
reporters: ['coverage', 'mocha'],
coverageReporter: {
reporters: [{type: 'text'}, {
type: 'html',
dir: 'coverage',
subdir: 'html'
}, {
type: 'lcovonly',
dir: 'coverage',
subdir: 'lcov'
}]
},
logLevel: config.LOG_DISABLE,
singleRun: true,
autoWatch: false
});
};
{
"scripts": {
"test": "./node_modules/.bin/karma start ./test/karma.conf.js"
},
"devDependencies": {
"istanbul": "gotwarlost/istanbul#source-map",
"babelify": "^6.3.0",
"browserify": "^11.0.1",
"browserify-istanbul": "^0.2.1",
"chai": "^3.2.0",
"karma": "^0.13.9",
"karma-browserify": "^4.3.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.2.0",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^1.1.1",
"karma-phantomjs-launcher": "^0.2.1",
"mocha": "^2.3.0",
"phantomjs": "^1.9.18",
"karma-coverage": "^0.5.1"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment