gitlab-org--gitlab-foss/config/karma.config.js

50 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-12-29 16:42:48 -05:00
var path = require('path');
var webpack = require('webpack');
2016-12-29 16:42:48 -05:00
var webpackConfig = require('./webpack.config.js');
var ROOT_PATH = path.resolve(__dirname, '..');
// remove problematic plugins
if (webpackConfig.plugins) {
webpackConfig.plugins = webpackConfig.plugins.filter(function (plugin) {
return !(
plugin instanceof webpack.optimize.CommonsChunkPlugin ||
plugin instanceof webpack.DefinePlugin
);
});
}
webpackConfig.devtool = 'cheap-inline-source-map';
2016-12-29 16:42:48 -05:00
// Karma configuration
module.exports = function(config) {
var progressReporter = process.env.CI ? 'mocha' : 'progress';
var karmaConfig = {
2016-12-29 16:42:48 -05:00
basePath: ROOT_PATH,
2017-01-13 11:05:26 -05:00
browsers: ['PhantomJS'],
frameworks: ['jasmine'],
2016-12-29 16:42:48 -05:00
files: [
{ pattern: 'spec/javascripts/test_bundle.js', watched: false },
{ pattern: 'spec/javascripts/fixtures/**/*@(.json|.html|.html.raw)', included: false },
2016-12-29 16:42:48 -05:00
],
preprocessors: {
'spec/javascripts/**/*.js': ['webpack', 'sourcemap'],
2016-12-29 16:42:48 -05:00
},
reporters: [progressReporter],
webpack: webpackConfig,
webpackMiddleware: { stats: 'errors-only' },
};
if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') {
karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = {
reports: ['html', 'text-summary'],
dir: 'coverage-javascript/',
subdir: '.',
fixWebpackSourcePaths: true
};
}
config.set(karmaConfig);
2016-12-29 16:42:48 -05:00
};