Created
October 11, 2016 09:37
-
-
Save zhaiduo/a4f548ef5a5c376d2230c8fe17d61a03 to your computer and use it in GitHub Desktop.
ES6 + Babel + Browserify + Mocha + Chai + Karma + Istanbul + PhantomJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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