'use strict'; const path = require('path'); const project = require('./aurelia_project/aurelia.json'); let testSrc = [ { pattern: project.unitTestRunner.source, included: false }, { pattern: 'test/unit/setup.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/setup.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, // browsers: ['PhantomJS'], browsers: ['Chrome'], // browsers: ['ChromeNoSandboxHeadless'], // headless Chrome should work from v59+ customLaunchers: { 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, phantomjsLauncher: { // Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom) exitOnResourceError: true } }); };