Skip to content

Commit

Permalink
Load base karma config.
Browse files Browse the repository at this point in the history
Only override what's needed for SauceLabs.
  • Loading branch information
davidlehn committed Jan 28, 2017
1 parent b12b34e commit 0aff93d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 87 deletions.
100 changes: 14 additions & 86 deletions karma-sauce.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,21 @@
* Karma Sauce Labs configuration
*
* `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environmental variables should
* be set. For configuration details, see: https://github.com/karma-runner/karma-sauce-launcher
* be set. For configuration details, see:
* https://github.com/karma-runner/karma-sauce-launcher
*/
module.exports = function(config) {
// bundler to test: webpack, browserify
var bundler = process.env.BUNDLER || 'webpack';

var frameworks = ['mocha'];
// main bundle preprocessors
var preprocessors = [];
// webworker bundle preprocessors (always use webpack)
var workerPreprocessors = ['webpack'];
var baseConfig = require('./karma.conf');

if(bundler === 'browserify') {
frameworks.push(bundler);
preprocessors.push(bundler);
} else if(bundler === 'webpack') {
preprocessors.push(bundler);
} else {
throw Error('Unknown bundler');
}
module.exports = function(config) {
// load base forge karma config
baseConfig(config);

// Define an unlimited number of browser/OS combinations here. Sauce Labs
// will manage concurrency based on user's account restrictions.
// Platform Configurator Tool: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
var customLaunchers = {
// Platform Configurator Tool:
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
var sauceLabsCustomLaunchers = {
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
Expand Down Expand Up @@ -72,80 +62,18 @@ module.exports = function(config) {
};

config.set({
// 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: frameworks,

// list of files / patterns to load in the browser
files: [
'tests/unit/index.js',
// for webworkers
{
pattern: 'lib/prime.worker.js',
watched: false, included: false, served: true, nocache: false
}
],

// list of files to exclude
exclude: [
],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'tests/unit/index.js': preprocessors,
'lib/prime.worker.js': workerPreprocessors
},

browserify: {
debug: true
//transform: ['uglifyify']
},

// web server port
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
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,

sauceLabs: {
testName: 'Forge Unit Tests',
startConnect: true
},
captureTimeout: 180000,
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
reporters: ['dots', 'saucelabs'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
// merge SauceLabs launchers
customLaunchers: sauceLabsCustomLaunchers,

// Mocha
client: {
mocha: {
// increase from default 2s
timeout: 20000
}
},
// default to only SauceLabs launchers
browsers: Object.keys(sauceLabsCustomLaunchers),

// Proxied paths
proxies: {
'/forge/prime.worker.js': '/base/lib/prime.worker.js'
}
reporters: ['dots', 'saucelabs']
});
};
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = function(config) {
client: {
mocha: {
// increase from default 2s
timeout: 10000
timeout: 20000
}
},

Expand Down

0 comments on commit 0aff93d

Please sign in to comment.