2019-01-02 04:24:12 -06:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
|
|
|
// Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
2017-03-15 12:09:22 -05:00
|
|
|
// Karma configuration
|
2017-06-12 10:51:54 -05:00
|
|
|
const webpackConfig = require('./webpack.test.config.js');
|
2018-02-09 05:09:04 -06:00
|
|
|
const isDocker = require('is-docker')();
|
2018-05-30 21:09:00 -05:00
|
|
|
const webpack = require('webpack');
|
2017-03-15 12:09:22 -05:00
|
|
|
|
2017-06-12 10:51:54 -05:00
|
|
|
module.exports = function (config) {
|
2017-03-15 12:09:22 -05:00
|
|
|
config.set({
|
2018-05-30 21:09:00 -05:00
|
|
|
frameworks: ['jasmine', 'source-map-support'],
|
2017-07-07 09:54:42 -05:00
|
|
|
reporters: ['progress', 'kjhtml'],
|
2017-06-12 10:51:54 -05:00
|
|
|
plugins: [
|
|
|
|
'karma-webpack',
|
2018-02-09 05:09:04 -06:00
|
|
|
'karma-chrome-launcher',
|
2017-06-12 10:51:54 -05:00
|
|
|
'karma-jasmine',
|
|
|
|
'karma-jasmine-html-reporter',
|
2018-05-30 21:09:00 -05:00
|
|
|
'karma-source-map-support',
|
|
|
|
'karma-sourcemap-loader',
|
|
|
|
new webpack.SourceMapDevToolPlugin({
|
|
|
|
/*
|
|
|
|
* filename: null, // if no value is provided the sourcemap is inlined
|
|
|
|
*/
|
|
|
|
filename: '[name].js.map',
|
2019-03-07 04:51:59 -06:00
|
|
|
test: /\.js$/i, // process .js files only
|
2018-05-30 21:09:00 -05:00
|
|
|
}),
|
2017-06-12 10:51:54 -05:00
|
|
|
],
|
2017-03-15 12:09:22 -05:00
|
|
|
files: [
|
2017-06-23 03:35:56 -05:00
|
|
|
'pgadmin/static/bundle/slickgrid.js',
|
2018-03-20 04:31:38 -05:00
|
|
|
{pattern: 'pgadmin/static/**/*.js', included: false, watched: true},
|
|
|
|
{pattern: 'pgadmin/browser/static/js/**/*.js', included: false, watched: true},
|
|
|
|
{pattern: 'regression/javascript/**/*.js', watched: true},
|
2017-03-15 12:09:22 -05:00
|
|
|
],
|
|
|
|
|
|
|
|
// list of files to exclude
|
|
|
|
exclude: [
|
2017-03-15 12:13:55 -05:00
|
|
|
'pgadmin/static/vendor/**/*[Tt]est.js',
|
2017-06-12 10:55:14 -05:00
|
|
|
'pgadmin/static/vendor/**/*[Ss]pec.js',
|
2017-03-15 12:09:22 -05:00
|
|
|
],
|
|
|
|
|
|
|
|
// preprocess matching files before serving them to the browser
|
|
|
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
|
|
|
preprocessors: {
|
2019-03-07 04:51:59 -06:00
|
|
|
'pgadmin/**/js/**/*.js?': ['sourcemap'],
|
2018-05-30 21:09:00 -05:00
|
|
|
'regression/javascript/**/*.js': ['webpack', 'sourcemap'],
|
|
|
|
'pgadmin/static/bundle/slickgrid.js': ['webpack', 'sourcemap'],
|
2017-03-15 12:09:22 -05:00
|
|
|
},
|
|
|
|
|
2017-06-12 10:51:54 -05:00
|
|
|
webpack: webpackConfig,
|
|
|
|
webpackMiddleware: {
|
|
|
|
stats: 'errors-only',
|
|
|
|
},
|
2017-03-15 12:09:22 -05:00
|
|
|
|
|
|
|
port: 9876,
|
|
|
|
|
|
|
|
// enable / disable colors in the output (reporters and logs)
|
|
|
|
colors: true,
|
|
|
|
|
|
|
|
// level of logging
|
|
|
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
2017-06-12 10:51:54 -05:00
|
|
|
logLevel: config.LOG_WARN,
|
2017-03-15 12:09:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
// enable / disable watching file and executing tests whenever any file changes
|
2017-06-12 10:51:54 -05:00
|
|
|
autoWatch: true,
|
2018-03-20 04:31:38 -05:00
|
|
|
usePolling: true,
|
2017-03-15 12:09:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
// start these browsers
|
|
|
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
2018-02-09 05:09:04 -06:00
|
|
|
customLaunchers: {
|
|
|
|
ChromeCustom: {
|
|
|
|
base: 'ChromeHeadless',
|
|
|
|
// We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs
|
|
|
|
// more permissions than Docker allows by default)
|
2018-02-19 04:53:54 -06:00
|
|
|
flags: isDocker ? ['--no-sandbox'] : [],
|
|
|
|
},
|
2018-02-09 05:09:04 -06:00
|
|
|
},
|
|
|
|
browsers: ['ChromeCustom'],
|
2017-03-15 12:09:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
// Continuous Integration mode
|
|
|
|
// if true, Karma captures browsers, runs the tests and exits
|
2017-06-12 10:51:54 -05:00
|
|
|
singleRun: false,
|
2017-03-15 12:09:22 -05:00
|
|
|
|
|
|
|
// Concurrency level
|
|
|
|
// how many browser should be started simultaneous
|
2017-06-12 10:55:14 -05:00
|
|
|
concurrency: Infinity,
|
2017-06-12 10:51:54 -05:00
|
|
|
});
|
|
|
|
};
|