karma.conf.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. module.exports = function(config) {
  2. var browsers = config.browsers;
  3. var frameworks = ['qunit'];
  4. var plugins = ['karma-qunit'];
  5. var addBrowserLauncher = function(browser) {
  6. plugins.push('karma-' + browser.toLowerCase() + '-launcher');
  7. };
  8. // On Travis CI, we can only run in Firefox.
  9. if (process.env.TRAVIS) {
  10. browsers = ['Firefox'];
  11. browsers.forEach(addBrowserLauncher);
  12. // If specific browsers are requested on the command line, load their
  13. // launchers.
  14. } else if (browsers.length) {
  15. browsers.forEach(addBrowserLauncher);
  16. // If no browsers are specified, we will do a `karma-detect-browsers` run,
  17. // which means we need to set up that plugin and all the browser plugins
  18. // we are supporting.
  19. } else {
  20. frameworks.push('detectBrowsers');
  21. plugins.push('karma-detect-browsers');
  22. ['chrome', 'firefox', 'ie', 'safari'].forEach(addBrowserLauncher);
  23. }
  24. config.set({
  25. basePath: '..',
  26. frameworks: frameworks,
  27. files: [
  28. 'node_modules/sinon/pkg/sinon.js',
  29. 'node_modules/sinon/pkg/sinon-ie.js',
  30. 'test/dist/bundle.js'
  31. ],
  32. browsers: browsers,
  33. plugins: plugins,
  34. detectBrowsers: {
  35. usePhantomJS: false
  36. },
  37. reporters: ['dots'],
  38. port: 9876,
  39. colors: true,
  40. autoWatch: false,
  41. singleRun: true,
  42. concurrency: Infinity
  43. });
  44. };