Configuring karma to work with webpack
This commit is contained in:
parent
a8a76651c2
commit
2a496bf4c1
@ -1,30 +1,21 @@
|
||||
var _ = require('lodash'),
|
||||
config = require('./config');
|
||||
var webpack = require('./webpack.config.js');
|
||||
|
||||
module.exports = function(karma) {
|
||||
var globs = _.flatten([
|
||||
config.globs.js,
|
||||
config.globs.spec
|
||||
]);
|
||||
|
||||
karma.set({
|
||||
frameworks: ['browserify', 'jasmine'],
|
||||
files: globs,
|
||||
preprocessors: _(globs)
|
||||
.zipObject()
|
||||
.mapValues(_.constant(['browserify']))
|
||||
.valueOf(),
|
||||
files: [ 'spec/test_index.js' ],
|
||||
preprocessors: {
|
||||
'spec/test_index.js': ['webpack', 'sourcemap']
|
||||
},
|
||||
reporters: ['progress', 'notify'],
|
||||
colors: true,
|
||||
logLevel: karma.LOG_INFO,
|
||||
browsers: ['Firefox'],
|
||||
autoWatch: true,
|
||||
singleRun: false,
|
||||
browserify: _.extend({
|
||||
configure: function(bundler) {
|
||||
bundler.transform(require('./lib/canopy-transform'));
|
||||
bundler.transform(require('babelify'));
|
||||
}
|
||||
}, config.browserify)
|
||||
webpack: {
|
||||
devtool: 'inline-source-map',
|
||||
module: webpack.module
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -33,10 +33,11 @@
|
||||
"imports-loader": "^0.6.5",
|
||||
"jasmine-core": "^2.4.1",
|
||||
"karma": "^1.1.2",
|
||||
"karma-browserify": "^5.0.2",
|
||||
"karma-firefox-launcher": "^1.0.0",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-notify-reporter": "^1.0.1",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^1.8.0",
|
||||
"lodash": "^4.6.1",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"snapsvg": "^0.4.0",
|
||||
|
2
spec/test_index.js
Normal file
2
spec/test_index.js
Normal file
@ -0,0 +1,2 @@
|
||||
var testsContext = require.context(".", true, /_spec$/);
|
||||
testsContext.keys().forEach(testsContext);
|
Loading…
Reference in New Issue
Block a user