/* eslint-disable consts-on-top, no-process-env, require-jsdoc */
/* eslint-disable no-process-env, require-jsdoc */
const webdriverConfig = {
hostname: 'fe.nhnent.com',
port: 4444,
remoteHost: true
};
function setConfig(defaultConfig, server) {
if (server === 'ne') {
defaultConfig.customLaunchers = {
'IE9': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'internet explorer',
version: '9'
},
'IE10': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'internet explorer',
version: '10'
},
'IE11': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'internet explorer',
version: '11'
},
'Edge': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'MicrosoftEdge'
},
'Chrome-WebDriver': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'chrome'
},
'Firefox-WebDriver': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'firefox'
},
'Safari-WebDriver': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'safari'
}
};
defaultConfig.browsers = [
'IE9',
'IE10',
// 'IE11',
// 'Edge',
'Chrome-WebDriver',
'Firefox-WebDriver'
// 'Safari-WebDriver'
];
defaultConfig.reporters.push('coverage');
defaultConfig.reporters.push('junit');
defaultConfig.coverageReporter = {
dir: 'report/coverage/',
reporters: [
{
type: 'html',
subdir(browser) {
return `report-html/${browser}`;
}
},
{
type: 'cobertura',
subdir(browser) {
return `report-cobertura/${browser}`;
},
file: 'cobertura.txt'
}
]
};
defaultConfig.junitReporter = {
outputDir: 'report/junit',
suite: ''
};
} else {
defaultConfig.browsers = [
'ChromeHeadless'
];
}
}
module.exports = function(config) {
const defaultConfig = {
basePath: './',
frameworks: [
'jasmine',
'jquery-3.2.1',
'es5-shim'
],
files: [
// reason for not using karma-jasmine-jquery framework is that including older jasmine-karma file
// included jasmine-karma version is 2.0.5 and this version don't support ie8
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
'test/index.js',
{
pattern: 'test/fixtures/*.jpg',
watched: false,
included: false,
served: true
},
{
pattern: 'test/fixtures/*.png',
watched: false,
included: false,
served: true
}
],
preprocessors: {
'test/index.js': ['webpack', 'sourcemap']
},
reporters: ['dots'],
webpack: {
devtool: 'inline-source-map',
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /(test|bower_components|node_modules)/,
loader: 'istanbul-instrumenter',
query: {
esModules: true
}
},
{
test: /\.js$/,
include: /src/,
exclude: /(bower_components|node_modules)/,
loader: 'eslint-loader'
}
],
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
},
{
test: /\.styl$/,
loader: 'css-loader!stylus-loader?paths=src/css/'
}
]
}
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: true
};
/* eslint-disable */
setConfig(defaultConfig, process.env.KARMA_SERVER);
config.set(defaultConfig);
};
|