2018-10-01 08:45:18 +00:00
|
|
|
var coverage = process.env.COVERAGE;
|
|
|
|
|
2015-10-05 13:08:49 +00:00
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var basePath = '../../';
|
|
|
|
|
|
|
|
var absoluteBasePath = path.resolve(path.join(__dirname, basePath));
|
|
|
|
|
2017-10-22 20:21:51 +00:00
|
|
|
/* global process */
|
|
|
|
|
|
|
|
// configures browsers to run test against
|
|
|
|
// any of [ 'ChromeHeadless', 'Chrome', 'Firefox', 'IE', 'PhantomJS' ]
|
|
|
|
var browsers =
|
|
|
|
(process.env.TEST_BROWSERS || 'PhantomJS')
|
|
|
|
.replace(/^\s+|\s+$/, '')
|
|
|
|
.split(/\s*,\s*/g)
|
|
|
|
.map(function(browser) {
|
|
|
|
if (browser === 'ChromeHeadless') {
|
|
|
|
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
|
|
|
|
|
|
|
// workaround https://github.com/GoogleChrome/puppeteer/issues/290
|
|
|
|
if (process.platform === 'linux') {
|
|
|
|
return 'ChromeHeadless_Linux';
|
|
|
|
}
|
|
|
|
}
|
2018-04-04 14:52:46 +00:00
|
|
|
|
|
|
|
return browser;
|
2017-10-22 20:21:51 +00:00
|
|
|
});
|
|
|
|
|
2018-10-01 08:45:18 +00:00
|
|
|
var suite = coverage ? 'test/all.js' : 'test/suite.js';
|
|
|
|
|
2015-10-05 13:08:49 +00:00
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
module.exports = function(karma) {
|
|
|
|
karma.set({
|
|
|
|
|
2015-10-05 13:08:49 +00:00
|
|
|
basePath: basePath,
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2015-10-09 23:35:41 +00:00
|
|
|
frameworks: [
|
|
|
|
'mocha',
|
|
|
|
'sinon-chai'
|
|
|
|
],
|
2014-03-11 14:54:36 +00:00
|
|
|
|
|
|
|
files: [
|
2018-10-01 08:45:18 +00:00
|
|
|
suite
|
2014-03-11 14:54:36 +00:00
|
|
|
],
|
2014-04-29 23:57:54 +00:00
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
preprocessors: {
|
2018-10-01 08:45:18 +00:00
|
|
|
[ suite ]: [ 'webpack', 'env' ]
|
2014-03-11 14:54:36 +00:00
|
|
|
},
|
|
|
|
|
2019-01-08 21:40:41 +00:00
|
|
|
reporters: [ 'progress' ].concat(coverage ? 'coverage' : []),
|
2015-10-09 23:35:41 +00:00
|
|
|
|
2017-11-23 09:46:29 +00:00
|
|
|
customLaunchers: {
|
|
|
|
ChromeHeadless_Linux: {
|
|
|
|
base: 'ChromeHeadless',
|
|
|
|
flags: [
|
|
|
|
'--no-sandbox',
|
|
|
|
'--disable-setuid-sandbox'
|
|
|
|
],
|
|
|
|
debug: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-10-01 08:45:18 +00:00
|
|
|
coverageReporter: {
|
|
|
|
reporters: [
|
|
|
|
{ type: 'lcov', subdir: '.' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2017-10-22 20:21:51 +00:00
|
|
|
browsers: browsers,
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2014-09-25 07:54:40 +00:00
|
|
|
browserNoActivityTimeout: 30000,
|
2014-07-17 07:02:40 +00:00
|
|
|
|
2018-01-05 15:09:39 +00:00
|
|
|
singleRun: true,
|
|
|
|
autoWatch: false,
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2018-07-13 13:50:55 +00:00
|
|
|
webpack: {
|
|
|
|
mode: 'development',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css|\.bpmn$/,
|
|
|
|
use: 'raw-loader'
|
|
|
|
}
|
2018-10-01 08:45:18 +00:00
|
|
|
].concat(coverage ?
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
use: {
|
|
|
|
loader: 'istanbul-instrumenter-loader',
|
|
|
|
options: { esModules: true }
|
|
|
|
},
|
|
|
|
include: /lib\.*/,
|
|
|
|
exclude: /node_modules/
|
|
|
|
} : []
|
|
|
|
)
|
2018-07-13 13:50:55 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
mainFields: [
|
|
|
|
'dev:module',
|
|
|
|
'browser',
|
|
|
|
'module',
|
|
|
|
'main'
|
|
|
|
],
|
|
|
|
modules: [
|
|
|
|
'node_modules',
|
|
|
|
absoluteBasePath
|
|
|
|
]
|
|
|
|
}
|
2014-03-11 14:54:36 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|