Skip to content

Instantly share code, notes, and snippets.

@andrewk
Last active August 29, 2015 14:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewk/6a7a8828d29a3711ff0c to your computer and use it in GitHub Desktop.
Save andrewk/6a7a8828d29a3711ff0c to your computer and use it in GitHub Desktop.
Webpack + Jasmine 2 + Flight + Karma (https://github.com/andrewk/webpack-jasmine-flight)
module.exports = function (config) {
'use strict';
config.set({
basePath: '',
preprocessors: {
'assets/tests/**/*.js': ['webpack'], // our specs
'assets/js/**/*.js': ['webpack'], // our components
'assets/components/webpack-jasmine-flight/lib/jasmine-flight.js': ['webpack']
},
frameworks: ['jasmine', 'webpack'],
plugins: [
'karma-phantomjs-launcher',
'karma-chrome-launcher',
'karma-webpack',
'karma-jasmine'
],
// list of files / patterns to load in the browser
files: [
'assets/components/jquery/dist/jquery.js',
'assets/components/es5-shim/es5-shim.js', // for phantomjs ES5 compat
'assets/components/es5-shim/es5-sham.js',
'assets/components/jasmine-jquery/lib/jasmine-jquery.js',
'assets/components/jasmine-ajax/lib/mock-ajax.js',
'assets/components/webpack-jasmine-flight/lib/jasmine-flight.js',
'assets/tests/spec/**/*.spec.js',
'assets/tests/fixtures/**/*.html',
'assets/tests/run.js'
],
exclude: [
'assets/components/**/specs/**/*',
'assets/components/**/tests/**/*'
],
reporters: ['dots'],
autoWatch: true,
browsers: [
'Chrome'
],
webpack: {
resolve: require('./webpack.resolve.js') // webpack aliases
},
webpackServer: {
progress: false,
stats: false,
debug: false,
quiet: true
},
captureTimeout: 5000,
singleRun: false,
reportSlowerThan: 500,
color: true
});
};
// separate file so we can refer to it from webpack.config.js and karma.conf.js
module.exports = {
root: __dirname,
alias: {
'jasmine-flight': 'assets/components/webpack-jasmine-flight/lib/jasmine-flight.js', // i don't remember if I truly needed this...
},
modulesDirectories: ['assets/js', 'assets/components'], // assets/components is our bower_components dir
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment