Created
August 11, 2016 22:39
-
-
Save beeflamian/180dc8565e39509c11ee61f6cf844f38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'), | |
tags = [], | |
karmaConfig, files, sauceBrowsers; | |
// Base Karma configuration | |
karmaConfig = { | |
browserNoActivityTimeout: 600000, | |
browserDisconnectTolerance: 5, | |
// base path that will be used to resolve all patterns (eg. files, exclude) | |
basePath: '', | |
// frameworks to use | |
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
frameworks: ['qunit'], | |
files: [ | |
{ pattern: 'public/dashboard/assets/sqmarket/*', watched: false, included: false, served: true }, | |
{ pattern: 'public/dashboard/assets/**/*.png', watched: false, included: false, served: true }, | |
'node_modules/qunitjs/qunit/qunit.css', | |
'public/dashboard/**/test_helper-*.js', | |
'public/dashboard/**/test_helper-*.css', | |
'public/dashboard/**/hide_passed-*.js', | |
'public/dashboard/**/*.module-*.js', | |
{ pattern: 'spec/fixtures/computed_permissions/*.json', watched: true, served: true, included: false } | |
], | |
// list of files to exclude | |
exclude: [], | |
reporters: ['mocha'], | |
preprocessors: { | |
'config/demo_user_data.json': ['json_fixtures'] | |
}, | |
jsonFixturesPreprocessor: { | |
stripPrefix: 'config/' | |
}, | |
proxies: { | |
'/dashboard/assets/': 'http://localhost:' + process.env.KARMA_PORT + '/base/public/dashboard/assets/' | |
}, | |
// web server port | |
port: process.env.KARMA_PORT, | |
// enable / disable colors in the output (reporters and logs) | |
colors: false, | |
// start these browsers | |
browsers: ['SlimerJS'], | |
// Continuous Integration mode | |
// if true, Karma captures browsers, runs the tests and exits | |
singleRun: false | |
}; | |
if (process.env.DEPRECATIONS) { | |
karmaConfig.frameworks = ['qunit-ember-deprecations']; | |
} | |
// Add test files | |
if (process.env.RUN_LIST) { | |
files = process.env.RUN_LIST.split(','); | |
files.forEach(function(file) { | |
// strip test/ and .coffee | |
var testPath = file.substring(5, file.length - 7); | |
karmaConfig.files.push('public/dashboard/assets/' + testPath + '*.js'); | |
}); | |
tags = files.map(function(file) { | |
var tag = file.split('/'); | |
return tag[tag.length - 1]; | |
}); | |
tags.unshift('Shard-' + process.env.SHARD); | |
} else { | |
karmaConfig.files.push('public/dashboard/assets/qunit/acceptance/*.test-*.js'); | |
karmaConfig.files.push('public/dashboard/assets/qunit/acceptance/**/*.test-*.js'); | |
karmaConfig.files.push('public/dashboard/assets/qunit/unit/*.test-*.js'); | |
karmaConfig.files.push('public/dashboard/assets/qunit/unit/**/*.test-*.js'); | |
} | |
if (process.env.JENKINS === '1') { | |
sauceBrowsers = { | |
sl_chrome: { | |
base: 'SauceLabs', | |
browserName: 'chrome', | |
platform: 'OS X 10.9', | |
version: '35', | |
'video-upload-on-pass': false, | |
'idle-timeout': 290 | |
} | |
}; | |
karmaConfig.sauceLabs = { | |
username: '', | |
accessKey: '', | |
tunnelIdentifier: 'dashboard', | |
testName: 'dashboard', | |
build: process.env.BUILD || process.env.GIT_COMMIT, | |
tags: tags, | |
recordVideo: true, | |
// We will start the SauceConnect tunnel manually | |
startConnect: false | |
}; | |
karmaConfig.customLaunchers = sauceBrowsers; | |
karmaConfig.browsers = Object.keys(sauceBrowsers); | |
karmaConfig.reporters = ['mocha', 'saucelabs']; | |
karmaConfig.singleRun = true; | |
} | |
if (process.env.IE_VM && process.env.ENVIRONMENT) { | |
karmaConfig.browsers = [path.resolve('script/ie_launcher')]; | |
karmaConfig.singleRun = true; | |
} | |
if (process.env.KARMA_BROWSERS) { | |
karmaConfig.browsers = process.env.KARMA_BROWSERS.split(','); | |
karmaConfig.singleRun = true; | |
} | |
module.exports = function(config) { | |
// level of logging | |
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | |
karmaConfig.logLevel = config.LOG_DEBUG; | |
config.set(karmaConfig); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment