2015-10-05 13:08:49 +00:00
|
|
|
var path = require('path');
|
|
|
|
|
2020-11-03 12:44:40 +00:00
|
|
|
var collectTranslations = process.env.COLLECT_TRANSLATIONS;
|
|
|
|
|
2020-12-21 12:32:16 +00:00
|
|
|
var singleStart = process.env.SINGLE_START;
|
|
|
|
|
2020-03-12 10:29:03 +00:00
|
|
|
var coverage = process.env.COVERAGE;
|
2017-10-22 20:21:51 +00:00
|
|
|
|
|
|
|
// configures browsers to run test against
|
|
|
|
// any of [ 'ChromeHeadless', 'Chrome', 'Firefox', 'IE', 'PhantomJS' ]
|
2021-01-06 11:04:20 +00:00
|
|
|
var browsers = (process.env.TEST_BROWSERS || 'ChromeHeadless').split(',');
|
2020-03-12 10:29:03 +00:00
|
|
|
|
|
|
|
// use puppeteer provided Chrome for testing
|
|
|
|
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
|
|
|
|
|
|
|
var basePath = '../..';
|
|
|
|
|
|
|
|
var absoluteBasePath = path.resolve(path.join(__dirname, basePath));
|
2017-10-22 20:21:51 +00:00
|
|
|
|
2019-12-10 14:57:52 +00:00
|
|
|
var suite = coverage ? 'test/coverageBundle.js' : 'test/testBundle.js';
|
2018-10-01 08:45:18 +00:00
|
|
|
|
2015-10-05 13:08:49 +00:00
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
module.exports = function(karma) {
|
2020-11-03 12:44:40 +00:00
|
|
|
|
|
|
|
var config = {
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2020-03-12 10:29:03 +00:00
|
|
|
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: [
|
2020-04-16 03:58:09 +00:00
|
|
|
'node_modules/promise-polyfill/dist/polyfill.js',
|
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
|
|
|
|
2018-10-01 08:45:18 +00:00
|
|
|
coverageReporter: {
|
|
|
|
reporters: [
|
|
|
|
{ type: 'lcov', subdir: '.' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2020-03-12 10:29:03 +00:00
|
|
|
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
|
|
|
|
]
|
2019-11-06 10:22:35 +00:00
|
|
|
},
|
|
|
|
devtool: 'eval-source-map'
|
2014-03-11 14:54:36 +00:00
|
|
|
}
|
2020-11-03 12:44:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (collectTranslations) {
|
2020-12-21 12:32:16 +00:00
|
|
|
config.plugins = [].concat(config.plugins || ['karma-*'], require('./translation-reporter'));
|
2020-11-03 12:44:40 +00:00
|
|
|
config.reporters = [].concat(config.reporters || [], 'translation-reporter');
|
2020-12-21 08:50:14 +00:00
|
|
|
config.envPreprocessor = [].concat(config.envPreprocessor || [], 'COLLECT_TRANSLATIONS');
|
2020-11-03 12:44:40 +00:00
|
|
|
}
|
|
|
|
|
2020-12-21 12:32:16 +00:00
|
|
|
if (singleStart) {
|
|
|
|
config.browsers = [].concat(config.browsers, 'Debug');
|
|
|
|
config.envPreprocessor = [].concat(config.envPreprocessor || [], 'SINGLE_START');
|
|
|
|
}
|
|
|
|
|
2020-11-03 12:44:40 +00:00
|
|
|
karma.set(config);
|
2014-03-11 14:54:36 +00:00
|
|
|
};
|