karma.conf.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. const path = require('path');
  3. const project = require('./aurelia_project/aurelia.json');
  4. let testSrc = [
  5. { pattern: project.unitTestRunner.source, included: false },
  6. 'test/aurelia-karma.js'
  7. ];
  8. let output = project.platform.output;
  9. let appSrc = project.build.bundles.map(x => path.join(output, x.name));
  10. let entryIndex = appSrc.indexOf(path.join(output, project.build.loader.configTarget));
  11. let entryBundle = appSrc.splice(entryIndex, 1)[0];
  12. let files = [entryBundle].concat(testSrc).concat(appSrc);
  13. module.exports = function(config) {
  14. config.set({
  15. basePath: '',
  16. frameworks: [project.testFramework.id],
  17. files: files,
  18. exclude: [],
  19. preprocessors: {
  20. [project.unitTestRunner.source]: [project.transpiler.id]
  21. },
  22. 'babelPreprocessor': { options: project.transpiler.options },
  23. reporters: ['progress'],
  24. port: 9876,
  25. colors: true,
  26. logLevel: config.LOG_INFO,
  27. autoWatch: true,
  28. browsers: ['Chrome'],
  29. singleRun: false,
  30. // client.args must be a array of string.
  31. // Leave 'aurelia-root', project.paths.root in this order so we can find
  32. // the root of the aurelia project.
  33. client: {
  34. args: ['aurelia-root', project.paths.root]
  35. }
  36. });
  37. };