2022-03-19 11:34:43 +01:00
|
|
|
/* eslint-disable no-undef,no-process-env,no-underscore-dangle,no-global-assign,no-native-reassign */
|
2019-11-14 16:11:43 +01:00
|
|
|
// noinspection NpmUsedModulesInstalled
|
|
|
|
process = require('process');
|
|
|
|
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
|
|
|
|
2019-12-19 23:04:12 +01:00
|
|
|
const path = require('path');
|
|
|
|
|
2019-11-16 22:13:25 +01:00
|
|
|
// don't preprocess files on debug run
|
2019-12-19 23:04:12 +01:00
|
|
|
// if (!process.env._INTELLIJ_KARMA_INTERNAL_PARAMETER_debug && !process.argv.includes('--debug')) {
|
|
|
|
// reporters.push('coverage-istanbul');
|
|
|
|
// }
|
2019-11-16 22:13:25 +01:00
|
|
|
|
2019-11-14 16:11:43 +01:00
|
|
|
module.exports = function(config) {
|
|
|
|
config.set({
|
|
|
|
basePath: 'js/',
|
2020-12-26 21:32:31 +01:00
|
|
|
frameworks: [ 'jasmine', 'webpack' ],
|
2019-11-14 16:11:43 +01:00
|
|
|
files: [
|
|
|
|
{ pattern: 'test/*.test.js', type: 'module' },
|
2019-12-19 23:04:12 +01:00
|
|
|
{ pattern: 'test/helpers/*.js', type: 'module', included: false },
|
2019-12-24 13:33:54 +01:00
|
|
|
{ pattern: 'test/fixtures/*.html', included: false },
|
2019-12-19 23:04:12 +01:00
|
|
|
{ pattern: 'src/**/*.js', type: 'module', included: false }
|
2019-11-14 16:11:43 +01:00
|
|
|
],
|
|
|
|
exclude: [],
|
2019-12-19 23:04:12 +01:00
|
|
|
preprocessors: {
|
|
|
|
'test/*.test.js': [ 'webpack', 'sourcemap' ],
|
|
|
|
'test/helpers/*.js': [ 'webpack', 'sourcemap' ],
|
|
|
|
'src/**/*.js': [ 'sourcemap' ]
|
|
|
|
},
|
|
|
|
coverageIstanbulReporter: {
|
|
|
|
reports: [ 'html', 'text-summary', 'lcovonly' ],
|
|
|
|
dir: path.join(__dirname, 'coverage'),
|
|
|
|
fixWebpackSourcePaths: true,
|
|
|
|
'report-config': {
|
|
|
|
html: { outdir: 'html' }
|
|
|
|
}
|
2019-11-14 16:11:43 +01:00
|
|
|
},
|
|
|
|
// possible values: 'dots', 'progress'
|
2019-12-19 23:04:12 +01:00
|
|
|
reporters: [ 'progress', 'coverage-istanbul' ],
|
2019-11-14 16:11:43 +01:00
|
|
|
// web server port
|
|
|
|
port: 9876,
|
|
|
|
// enable / disable colors in the output (reporters and logs)
|
|
|
|
colors: true,
|
|
|
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
|
|
logLevel: config.LOG_INFO,
|
|
|
|
// enable / disable watching file and executing tests whenever any file changes
|
|
|
|
autoWatch: false,
|
|
|
|
// start these browsers
|
|
|
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
|
|
|
browsers: [ 'ChromeHeadless' ],
|
|
|
|
// Continuous Integration mode
|
|
|
|
// if true, Karma captures browsers, runs the tests and exits
|
|
|
|
singleRun: true,
|
|
|
|
// how many browser should be started simultaneous
|
2019-12-19 23:04:12 +01:00
|
|
|
concurrency: Infinity,
|
|
|
|
// webpack
|
|
|
|
webpack: {
|
|
|
|
mode: 'development',
|
|
|
|
devtool: 'inline-source-map',
|
|
|
|
watch: true,
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
include: path.resolve('js/src/'),
|
|
|
|
use: {
|
2022-03-19 11:34:43 +01:00
|
|
|
loader: '@jsdevtools/coverage-istanbul-loader',
|
2019-12-19 23:04:12 +01:00
|
|
|
options: { esModules: true }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
webpackMiddleware: {
|
|
|
|
noInfo: true
|
|
|
|
}
|
2019-11-14 16:11:43 +01:00
|
|
|
})
|
|
|
|
};
|