| 1 |
// Karma configuration |
| 2 |
// Generated on Wed Jun 20 2018 16:46:14 GMT+0200 (CEST) |
| 3 |
const webpackConfig = require('./webpack.config.js'); |
| 4 |
const webpack = require('webpack'); |
| 5 |
const path = require('path'); |
| 6 |
const process = require('process'); |
| 7 |
|
| 8 |
module.exports = function (config) { |
| 9 |
config.set({ |
| 10 |
basePath: '', |
| 11 |
frameworks: ['mocha', 'chai', 'sinon'], |
| 12 |
files: [ |
| 13 |
// we use 1 bundle for testing |
| 14 |
{ pattern: 'lib/test/index.js' }, |
| 15 |
], |
| 16 |
exclude: ['**/embed.js'], |
| 17 |
preprocessors: { |
| 18 |
// the bundle goes through webpack, and will emit (inline) source maps, which karma needs to read again |
| 19 |
'lib/test/index.js': ['webpack', 'sourcemap'], |
| 20 |
}, |
| 21 |
webpack: { |
| 22 |
module: { |
| 23 |
rules: webpackConfig[2].module.rules, |
| 24 |
}, |
| 25 |
// source mapping without inline does not seem to work |
| 26 |
devtool: 'inline-source-map', |
| 27 |
mode: 'development', |
| 28 |
resolve: { |
| 29 |
extensions: ['.js'], |
| 30 |
}, |
| 31 |
}, |
| 32 |
reporters: ['progress', 'mocha'], |
| 33 |
port: 9876, |
| 34 |
colors: true, |
| 35 |
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
| 36 |
logLevel: config.LOG_INFO, |
| 37 |
autoWatch: true, |
| 38 |
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
| 39 |
browsers: ['ChromeHeadless'], |
| 40 |
customLauncher: { |
| 41 |
ChromeHeadless: { |
| 42 |
base: 'ChromeHeadless', |
| 43 |
flags: ['--headless', '--remote-debugging-port=9222'], |
| 44 |
}, |
| 45 |
}, |
| 46 |
// if true, Karma captures browsers, runs the tests and exits |
| 47 |
singleRun: true, |
| 48 |
// how many browser should be started simultaneous |
| 49 |
concurrency: Infinity, |
| 50 |
}); |
| 51 |
}; |