113 lines
2.2 KiB
JavaScript
113 lines
2.2 KiB
JavaScript
var coverage = process.env.COVERAGE;
|
|
|
|
var path = require('path');
|
|
|
|
var basePath = '../../';
|
|
|
|
var absoluteBasePath = path.resolve(path.join(__dirname, basePath));
|
|
|
|
/* 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';
|
|
}
|
|
}
|
|
|
|
return browser;
|
|
});
|
|
|
|
var suite = coverage ? 'test/all.js' : 'test/suite.js';
|
|
|
|
|
|
module.exports = function(karma) {
|
|
karma.set({
|
|
|
|
basePath: basePath,
|
|
|
|
frameworks: [
|
|
'mocha',
|
|
'sinon-chai'
|
|
],
|
|
|
|
files: [
|
|
suite
|
|
],
|
|
|
|
preprocessors: {
|
|
[ suite ]: [ 'webpack', 'env' ]
|
|
},
|
|
|
|
reporters: [ 'progress' ].concat(coverage ? 'coverage' : []),
|
|
|
|
customLaunchers: {
|
|
ChromeHeadless_Linux: {
|
|
base: 'ChromeHeadless',
|
|
flags: [
|
|
'--no-sandbox',
|
|
'--disable-setuid-sandbox'
|
|
],
|
|
debug: true
|
|
}
|
|
},
|
|
|
|
coverageReporter: {
|
|
reporters: [
|
|
{ type: 'lcov', subdir: '.' }
|
|
]
|
|
},
|
|
|
|
browsers: browsers,
|
|
|
|
browserNoActivityTimeout: 30000,
|
|
|
|
singleRun: true,
|
|
autoWatch: false,
|
|
|
|
webpack: {
|
|
mode: 'development',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css|\.bpmn$/,
|
|
use: 'raw-loader'
|
|
}
|
|
].concat(coverage ?
|
|
{
|
|
test: /\.js$/,
|
|
use: {
|
|
loader: 'istanbul-instrumenter-loader',
|
|
options: { esModules: true }
|
|
},
|
|
include: /lib\.*/,
|
|
exclude: /node_modules/
|
|
} : []
|
|
)
|
|
},
|
|
resolve: {
|
|
mainFields: [
|
|
'dev:module',
|
|
'browser',
|
|
'module',
|
|
'main'
|
|
],
|
|
modules: [
|
|
'node_modules',
|
|
absoluteBasePath
|
|
]
|
|
},
|
|
devtool: 'eval-source-map'
|
|
}
|
|
});
|
|
};
|