module.exports = function(config) {
    if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
        console.error('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.');
        process.exit(1);
    }

    // Check out https://saucelabs.com/platforms for all browser/platform combos
    var customLaunchers = {
        slIOS8: {
            base: 'SauceLabs',
            browserName: 'iPhone',
            platform: 'OS X 10.10',
            version: '8.4'
        },
        slIOS9: {
            base: 'SauceLabs',
            browserName: 'iPhone',
            platform: 'OS X 10.11',
            version: '9.2'
        },
        // *Sigh* Cannot get this working with appium or selenium...
        // slIOS10: {
        //     base: 'SauceLabs',
        //     browserName: 'iPhone',
        //     platform: 'macOS 10.12',
        //     version: '10.2'
        // },
        slAndroid4: {
            base: 'SauceLabs',
            browserName: 'Android',
            platform: 'Linux',
            version: '4.4'
        },
        slAndroid5: {
            base: 'SauceLabs',
            browserName: 'Android',
            platform: 'Linux',
            version: '5.1'
        },
        slAndroid6: {
            base: 'SauceLabs',
            browserName: 'Android',
            platform: 'Linux',
            version: '6.0'
        },
        slChrome: {
            base: 'SauceLabs',
            browserName: 'chrome',
            version: 'latest'
        },
        slChromeBeta: {
            base: 'SauceLabs',
            browserName: 'chrome',
            version: 'beta'
        },
        slFirefox: {
            base: 'SauceLabs',
            browserName: 'firefox',
            version: 'latest'
        },
        // slFirefoxBeta: {
        //     base: 'SauceLabs',
        //     browserName: 'firefox',
        //     version: 'beta'
        // },
        slSafari8: {
            base: 'SauceLabs',
            browserName: 'safari',
            platform: 'OS X 10.10',
            version: '8.0'
        },
        slSafari9: {
            base: 'SauceLabs',
            browserName: 'safari',
            platform: 'OS X 10.11',
            version: '9.0'
        },
        slSafari10: {
            base: 'SauceLabs',
            browserName: 'safari',
            platform: 'macOS 10.12',
            version: '10.0'
        },
        slOpera: {
            base: 'SauceLabs',
            browserName: 'opera'
        },
        slEdge14: {
            base: 'SauceLabs',
            browserName: 'microsoftedge',
            platform: 'Windows 10',
            version: '14.14393'
        },
        slEdge13: {
            base: 'SauceLabs',
            browserName: 'microsoftedge',
            platform: 'Windows 10',
            version: '13.10586'
        },
        slIE11: {
            base: 'SauceLabs',
            browserName: 'internet explorer',
            platform: 'Windows 8.1',
            version: '11'
        },
        slIE10: {
            base: 'SauceLabs',
            browserName: 'internet explorer',
            platform: 'Windows 8',
            version: '10'
        },
        slIE9: {
            base: 'SauceLabs',
            browserName: 'internet explorer',
            platform: 'Windows 7',
            version: '9.0'
        }
        // Too unreliable on Sauce :(
        // slIE8: {
        //     base: 'SauceLabs',
        //     browserName: 'internet explorer',
        //     platform: 'Windows XP',
        //     version: '8.0'
        // }
        //slIE7: {
        //    base: 'SauceLabs',
        //    browserName: 'internet explorer',
        //    platform: 'Windows XP',
        //    version: '7'
        //}
    };

    config.set({
        basePath: '',
        frameworks: ['jasmine'],
        files: [
            'stackframe.js',
            'spec/*-spec.js'
        ],
        exclude: [],
        port: 9876,
        colors: false,
        logLevel: config.LOG_INFO,
        autoWatch: false,
        browserDisconnectTimeout: 10000,
        browserDisconnectTolerance: 1,
        browserNoActivityTimeout: 240000,
        captureTimeout: 240000,
        sauceLabs: {
            testName: 'stackframe unit tests',
            recordScreenshots: false,
            connectOptions: {
                port: 5757,
                logfile: 'sauce_connect.log'
            }
        },
        customLaunchers: customLaunchers,
        browsers: Object.keys(customLaunchers),
        reporters: ['dots', 'saucelabs', 'coverage', 'coveralls'],
        preprocessors: {
            'stackframe.js': 'coverage'
        },
        coverageReporter: {
            type: 'lcov',
            dir: 'coverage'
        },
        singleRun: true
    });
};

@@ -353,1046 +353,8 @@
 = %7B%0A
-        slIOS8: %7B%0A            base: 'SauceLabs',%0A            browserName: 'iPhone',%0A            platform: 'OS X 10.10',%0A            version: '8.4'%0A        %7D,%0A        slIOS9: %7B%0A            base: 'SauceLabs',%0A            browserName: 'iPhone',%0A            platform: 'OS X 10.11',%0A            version: '9.2'%0A        %7D,%0A        // *Sigh* Cannot get this working with appium or selenium...%0A        // slIOS10: %7B%0A        //     base: 'SauceLabs',%0A        //     browserName: 'iPhone',%0A        //     platform: 'macOS 10.12',%0A        //     version: '10.2'%0A        // %7D,%0A        slAndroid4: %7B%0A            base: 'SauceLabs',%0A            browserName: 'Android',%0A            platform: 'Linux',%0A            version: '4.4'%0A        %7D,%0A        slAndroid5: %7B%0A            base: 'SauceLabs',%0A            browserName: 'Android',%0A            platform: 'Linux',%0A            version: '5.1'%0A        %7D,%0A        slAndroid6: %7B%0A            base: 'SauceLabs',%0A            browserName: 'Android',%0A            platform: 'Linux',%0A            version: '6.0'%0A        %7D,%0A
     
@@ -741,19 +741,16 @@
 %0A       
- //
  slFiref
@@ -758,35 +758,32 @@
 xBeta: %7B%0A       
- //
      base: 'Sauc
@@ -789,35 +789,32 @@
 ceLabs',%0A       
- //
      browserName
@@ -826,39 +826,36 @@
 refox',%0A        
-//
     
- 
 version: 'beta'%0A
@@ -861,19 +861,16 @@
 %0A       
- //
  %7D,%0A    
@@ -881,17 +881,16 @@
 slSafari
-8
 : %7B%0A    
@@ -983,17 +983,17 @@
 S X 10.1
-0
+4
 ',%0A     
@@ -1013,430 +1013,12 @@
 n: '
-8.0'%0A        %7D,%0A        slSafari9: %7B%0A            base: 'SauceLabs',%0A            browserName: 'safari',%0A            platform: 'OS X 10.11',%0A            version: '9.0'%0A        %7D,%0A        slSafari10: %7B%0A            base: 'SauceLabs',%0A            browserName: 'safari',%0A            platform: 'macOS 10.12',%0A            version: '10.0'%0A        %7D,%0A        slOpera: %7B%0A            base: 'SauceLabs',%0A            browserName: 'opera
+12.0
 '%0A  
@@ -1040,18 +1040,16 @@
   slEdge
-14
 : %7B%0A    
@@ -1179,188 +1179,14 @@
 n: '
-14.14393'%0A        %7D,%0A        slEdge13: %7B%0A            base: 'SauceLabs',%0A            browserName: 'microsoftedge',%0A            platform: 'Windows 10',%0A            version: '13.10586
+latest
 '%0A  
@@ -1489,17 +1489,17 @@
 Windows 
-8
+7
 ',%0A     
@@ -1700,408 +1700,8 @@
   %7D%0A
-        // Too unreliable on Sauce :(%0A        // slIE8: %7B%0A        //     base: 'SauceLabs',%0A        //     browserName: 'internet explorer',%0A        //     platform: 'Windows XP',%0A        //     version: '8.0'%0A        // %7D%0A        //slIE7: %7B%0A        //    base: 'SauceLabs',%0A        //    browserName: 'internet explorer',%0A        //    platform: 'Windows XP',%0A        //    version: '7'%0A        //%7D%0A
     

Remove unsupported launchers from Karma config