karma.conf.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Karma configuration
  2. // Generated on Wed Jun 15 2016 09:05:44 GMT-0500 (CDT)
  3. /* eslint-disable */
  4. var module;
  5. module.exports = function(config) {
  6. 'use strict';
  7. var browsersMatrix = {
  8. 'win': ['Firefox', 'Chrome', 'Edge'],
  9. 'linux': ['Firefox', 'Chrome'],
  10. 'mac': ['Safari', 'Firefox', 'Chrome']
  11. },
  12. isWin = /^win/.test(process.platform),
  13. isLinux = /^linux/.test(process.platform),
  14. isMac = /^darwin/.test(process.platform),
  15. currentOSType = isWin ? 'win' : (isLinux ? 'linux' : 'mac'),
  16. currentOSBrowsers = browsersMatrix[currentOSType];
  17. var coverage_sources = [
  18. 'source/jquery.colorhelpers.js',
  19. 'source/jquery.canvaswrapper.js',
  20. 'source/jquery.flot.js',
  21. 'source/jquery.flot.saturated.js',
  22. 'source/jquery.flot.browser.js',
  23. 'source/jquery.flot.drawSeries.js',
  24. 'source/jquery.flot.errorbars.js',
  25. 'source/jquery.flot.uiConstants.js',
  26. 'source/jquery.flot.logaxis.js',
  27. 'source/jquery.flot.symbol.js',
  28. 'source/jQuery.flot.errorbars.js',
  29. 'source/jquery.flot.fillbetween.js',
  30. 'source/jquery.flot.flatdata.js',
  31. 'source/jquery.flot.navigate.js',
  32. 'source/jquery.flot.stack.js',
  33. 'source/jquery.flot.touchNavigate.js',
  34. 'source/jquery.flot.touch.js',
  35. 'source/jquery.flot.time.js',
  36. 'source/jquery.flot.axislabels.js',
  37. 'source/jquery.flot.composeImages.js',
  38. 'source/jquery.flot.selection.js',
  39. 'source/jquery.flot.legend.js',
  40. 'source/jquery.flot.hover.js'
  41. ];
  42. var sources = [
  43. 'source/jquery.js',
  44. 'lib/globalize.js',
  45. 'lib/globalize.culture.en-US.js',
  46. 'lib/jquery.event.drag.js',
  47. 'lib/jquery.mousewheel.js'
  48. ].concat(coverage_sources);
  49. var settings = {
  50. // base path that will be used to resolve all patterns (eg. files, exclude)
  51. basePath: '',
  52. // frameworks to use
  53. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  54. frameworks: ['jasmine-jquery', 'jasmine'],
  55. // list of files / patterns to load in the browser
  56. files: sources.concat([
  57. 'node_modules/webcharts-development-settings/testsUtils/*.js',
  58. { pattern: 'tests/svgstyle.css', included: true, served: true },
  59. 'tests/*.Test.js'
  60. ]),
  61. // list of files to exclude
  62. exclude: [],
  63. // preprocess matching files before serving them to the browser
  64. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  65. preprocessors: {
  66. '*.js': ['eslint'],
  67. 'tests/**/*.js': ['eslint']
  68. },
  69. eslint: {
  70. stopOnError: config.stopOnEsLintError ? true : false,
  71. showWarnings: true,
  72. engine: {
  73. configFile: 'node_modules/webcharts-development-settings/.eslintrc.json',
  74. emitError: true,
  75. emitWarning: true
  76. }
  77. },
  78. // test results reporter to use
  79. // possible values: 'dots', 'progress'
  80. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  81. reporters: ['kjhtml', 'spec'],
  82. coverageReporter: {
  83. type: 'lcov', // lcov or lcovonly are required for generating lcov.info files
  84. dir: 'coverage/'
  85. },
  86. // web server port
  87. port: 9876,
  88. // enable / disable colors in the output (reporters and logs)
  89. colors: true,
  90. // level of logging
  91. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  92. logLevel: config.LOG_INFO,
  93. // enable / disable watching file and executing tests whenever any file changes
  94. autoWatch: true,
  95. // start these browsers
  96. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  97. browsers: currentOSBrowsers,
  98. // Continuous Integration mode
  99. // if true, Karma captures browsers, runs the tests and exits
  100. singleRun: false,
  101. // Concurrency level
  102. // how many browsers should be started simultaneous
  103. concurrency: Infinity
  104. };
  105. if (config.coverage) {
  106. coverage_sources.forEach(function(pattern) {
  107. if (!settings.preprocessors[pattern]) {
  108. settings.preprocessors[pattern] = ['coverage'];
  109. } else {
  110. settings.preprocessors[pattern].push('coverage');
  111. }
  112. });
  113. settings.reporters.push('coverage');
  114. settings.reporters.push('coveralls');
  115. settings.browsers = ['Chrome'];
  116. }
  117. config.set(settings);
  118. };