'use strict'; const path = require('path'); const project = require('./aurelia_project/aurelia.json'); let testSrc = [ { pattern: project.unitTestRunner.source, included: false }, { pattern: 'src/**/*.js.map', included: false }, { pattern: 'test/unit/*.js', included: false }, { pattern: 'src/**/*.fixture.json', included: false }, 'test/aurelia-karma.js' ]; let output = project.platform.output; let appSrc = project.build.bundles.map(x => path.join(output, x.name)); let entryIndex = appSrc.indexOf(path.join(output, project.build.loader.configTarget)); let entryBundle = appSrc.splice(entryIndex, 1)[0]; let files = [entryBundle].concat(testSrc).concat(appSrc); module.exports = function(config) { config.set({ basePath: '', frameworks: [project.testFramework.id], files: files, exclude: [ 'src/**/lib/**/*.spec.js', 'src/**/util/**/*.spec.js', 'src/**/value-converters/**/*.spec.js' ], preprocessors: { [project.unitTestRunner.source]: [project.transpiler.id], ['test/unit/*.js']: [project.transpiler.id], 'src/**/!(*.spec)+(.js)': ['coverage'] }, 'babelPreprocessor': { options: project.transpiler.options }, reporters: ['coverage', 'spec'], coverageReporter: { type: 'html', dir: 'coverage/', subdir: 'components', includeAllSources: true }, port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, client: { captureConsole: true }, browsers: ['Chrome'], // Available : // browsers: ['Chrome', 'ChromeHeadless', 'Firefox', 'IE', 'IE10', 'IE9', 'IE8'], // browsers: ['ChromeNoSandboxHeadless'], // headless Chrome should work from v59+ // // PS: Firefox Requires Environment Variable set // FIREFOX_BIN = C:\Users\\AppData\Local\Mozilla Firefox\firefox.exe customLaunchers: { IE10: { base: 'IE', 'x-ua-compatible': 'IE=EmulateIE10' }, IE9: { base: 'IE', 'x-ua-compatible': 'IE=EmulateIE9' }, IE8: { base: 'IE', 'x-ua-compatible': 'IE=EmulateIE8' }, FirefoxHeadless: { base: 'Firefox', flags: [ // see https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options // requires https://bugzilla.mozilla.org/show_bug.cgi?id=1338004 // ENV VAR // WIN: set MOZ_HEADLESS=1; // LINUX: export MOZ_HEADLESS=1 ], displayName: 'Firefox Headless' }, ChromeNoSandboxHeadless: { base: 'Chrome', flags: [ '--no-sandbox', // See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md // https://www.chromestatus.com/features/5678767817097216 '--headless', '--disable-gpu', // Without a remote debugging port, Google Chrome exits immediately. ' --remote-debugging-port=9222' ] } }, singleRun: true }); };