加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
karma.conf.js 4.43 KB
一键复制 编辑 原始数据 按行查看 历史
/**
* Config file for testing
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
*/
const webdriverConfig = {
hostname: 'fe.nhnent.com',
port: 4444,
remoteHost: true
};
/**
* Set config by environment
* @param {object} defaultConfig - default config
* @param {string} server - server type ('ne' or local)
*/
function setConfig(defaultConfig, server) {
if (server === 'ne') {
defaultConfig.customLaunchers = {
'IE8': {
base: 'WebDriver',
config: webdriverConfig,
browserName: 'internet explorer',
version: '8'
},
'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 = [
'IE8',
'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 => `report-html/${browser}`
},
{
type: 'cobertura',
subdir: browser => `report-cobertura/${browser}`,
file: 'cobertura.txt'
}
]
};
defaultConfig.junitReporter = {
outputDir: 'report/junit',
suite: ''
};
} else {
defaultConfig.browsers = [
'ChromeHeadless'
];
}
}
module.exports = function(config) {
const defaultConfig = {
basePath: './',
frameworks: [
'jquery-1.11.0',
'fixture',
'jasmine',
'es5-shim'
],
files: [
{
pattern: 'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
watched: false
},
'test/index.js'
],
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-loader',
query: {esModules: true}
},
{
test: /\.js$/,
exclude: /(dist|bower_components|node_modules)/,
loader: 'eslint-loader'
}
],
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader'
}
]
}
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: true
};
/* eslint-disable */
setConfig(defaultConfig, process.env.KARMA_SERVER);
config.set(defaultConfig);
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化