Skip to content

Instantly share code, notes, and snippets.

@rssilva
Created May 6, 2016 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rssilva/5c2b8901237f6051c09ca9194aa6ea01 to your computer and use it in GitHub Desktop.
Save rssilva/5c2b8901237f6051c09ca9194aa6ea01 to your computer and use it in GitHub Desktop.
Writing tests using Jasmine with Browserify, Babel and generating coverage with Istanbul
const istanbul = require( 'browserify-istanbul' )
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['browserify', 'jasmine'],
files: [
// 'js/**/*.js',
'js/utils/**/*.js',
'test/spec/*.js'
],
exclude: [
'js/app.js', 'js/utils/*.js'
],
preprocessors: {
'test/spec/*.js': [ 'browserify' ],
'js/**/*.js': ['browserify', 'coverage']
},
reporters: ['dots', 'coverage'],
coverageReporter: {
dir: './test/coverage',
reporters: [
{ type: 'html', subdir: '.' },
{ type: 'text', subdir: '.', file: 'text.txt' },
]
},
browserify: {
debug: true,
bundleDelay: 1000,
extensions: [ '.js' ],
transform: [
'babelify',
istanbul( {
// ignore: [ '**/spec/**', '**/fixture/**' ]
} )
]
},
// port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
singleRun: true
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment