1import * as fs from 'fs'; 2import customLaunchersGenerator from './browsers'; 3import customKarmaDriver from './custom-karma-driver'; 4import {testHost} from './hosts-config'; 5 6export default (config) => { 7 const customLaunchers = customLaunchersGenerator(); 8 const DEBUG = process.env.DEBUG !== undefined; 9 const useBrowserStack = process.env.BROWSER_STACK_USERNAME !== undefined; 10 const browsers = useBrowserStack ? Object.keys(customLaunchers) : []; 11 12 config.set({ 13 basePath: '', 14 frameworks: ['jasmine'], 15 browserStack: { 16 forcelocal: true 17 }, 18 files: [ 19 'ts/build/integration-tests.js' 20 ], 21 preprocessors: { 22 '**/*.js': ['sourcemap', 'config-inject'] 23 }, 24 reporters: ['mocha'], 25 protocol: 'https', 26 hostname: testHost, 27 port: 9876, 28 httpsServerOptions: { 29 key: fs.readFileSync('..//misc/localhost.key', 'utf8'), 30 cert: fs.readFileSync('..//misc/localhost.crt', 'utf8') 31 }, 32 colors: true, 33 logLevel: DEBUG ? 'DEBUG' : 'INFO', 34 client: { 35 captureConsole: true, 36 runInParent: true, 37 useIframe: false 38 }, 39 plugins: [ 40 customKarmaDriver, 41 {'preprocessor:config-inject': [ 42 'factory', () => 43 (content, file, done) => 44 done(`window.DEBUG = ${DEBUG};\n${content}`) 45 ]}, 46 'karma-sourcemap-loader', 47 'karma-mocha-reporter', 48 'karma-jasmine' 49 ], 50 autoWatch: true, 51 captureTimeout: 120000, 52 browserDisconnectTimeout: 120000, 53 browserNoActivityTimeout: 120000, 54 singlerun: useBrowserStack, 55 concurrency: 1, 56 customLaunchers: customLaunchers, 57 browsers: browsers 58 }); 59}; 60