test-main.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. require.config({
  2. baseUrl: 'http://localhost:9876/base/',
  3. paths: {
  4. lodash: 'app/core/lodash_extended',
  5. 'lodash-src': 'vendor/lodash',
  6. moment: 'vendor/moment',
  7. chromath: 'vendor/chromath',
  8. filesaver: 'vendor/filesaver',
  9. angular: 'vendor/angular/angular',
  10. 'angular-route': 'vendor/angular-route/angular-route',
  11. 'angular-sanitize': 'vendor/angular-sanitize/angular-sanitize',
  12. angularMocks: 'vendor/angular-mocks/angular-mocks',
  13. 'angular-dragdrop': 'vendor/angular-native-dragdrop/draganddrop',
  14. 'angular-ui': 'vendor/angular-ui/ui-bootstrap-tpls',
  15. 'angular-strap': 'vendor/angular-other/angular-strap',
  16. timepicker: 'vendor/angular-other/timepicker',
  17. datepicker: 'vendor/angular-other/datepicker',
  18. bindonce: 'vendor/angular-bindonce/bindonce',
  19. crypto: 'vendor/crypto.min',
  20. spectrum: 'vendor/spectrum',
  21. jquery: 'vendor/jquery/dist/jquery',
  22. bootstrap: 'vendor/bootstrap/bootstrap',
  23. 'bootstrap-tagsinput': 'vendor/tagsinput/bootstrap-tagsinput',
  24. 'extend-jquery': 'app/components/extend-jquery',
  25. 'jquery.flot': 'vendor/flot/jquery.flot',
  26. 'jquery.flot.pie': 'vendor/flot/jquery.flot.pie',
  27. 'jquery.flot.events': 'vendor/flot/jquery.flot.events',
  28. 'jquery.flot.selection': 'vendor/flot/jquery.flot.selection',
  29. 'jquery.flot.stack': 'vendor/flot/jquery.flot.stack',
  30. 'jquery.flot.stackpercent':'vendor/flot/jquery.flot.stackpercent',
  31. 'jquery.flot.time': 'vendor/flot/jquery.flot.time',
  32. 'jquery.flot.crosshair': 'vendor/flot/jquery.flot.crosshair',
  33. 'jquery.flot.fillbelow': 'vendor/flot/jquery.flot.fillbelow',
  34. modernizr: 'vendor/modernizr-2.6.1',
  35. },
  36. shim: {
  37. bootstrap: {
  38. deps: ['jquery']
  39. },
  40. modernizr: {
  41. exports: 'Modernizr'
  42. },
  43. angular: {
  44. deps: ['jquery'],
  45. exports: 'angular'
  46. },
  47. angularMocks: {
  48. deps: ['angular'],
  49. },
  50. crypto: {
  51. exports: 'Crypto'
  52. },
  53. 'jquery.flot': ['jquery'],
  54. 'jquery.flot.pie': ['jquery', 'jquery.flot'],
  55. 'jquery.flot.events': ['jquery', 'jquery.flot'],
  56. 'jquery.flot.selection':['jquery', 'jquery.flot'],
  57. 'jquery.flot.stack': ['jquery', 'jquery.flot'],
  58. 'jquery.flot.stackpercent':['jquery', 'jquery.flot'],
  59. 'jquery.flot.time': ['jquery', 'jquery.flot'],
  60. 'jquery.flot.crosshair':['jquery', 'jquery.flot'],
  61. 'jquery.flot.fillbelow':['jquery', 'jquery.flot'],
  62. 'angular-route': ['angular'],
  63. 'angular-sanitize': ['angular'],
  64. 'angular-ui': ['angular'],
  65. 'angular-dragdrop': ['jquery', 'angular'],
  66. 'angular-mocks': ['angular'],
  67. 'angular-strap': ['angular', 'bootstrap','timepicker', 'datepicker'],
  68. 'bindonce': ['angular'],
  69. 'bootstrap-tagsinput': ['jquery'],
  70. timepicker: ['jquery', 'bootstrap'],
  71. datepicker: ['jquery', 'bootstrap'],
  72. }
  73. });
  74. function file2moduleName(filePath) {
  75. 'use strict';
  76. return filePath.replace(/\\/g, '/')
  77. .replace(/^\/base\//, '')
  78. .replace(/\.\w*$/, '');
  79. }
  80. require([
  81. 'lodash',
  82. 'angular',
  83. 'angularMocks',
  84. 'app/app',
  85. ], function(_, angular) {
  86. 'use strict';
  87. var specs = [];
  88. for (var file in window.__karma__.files) {
  89. if (/specs.*/.test(file)) {
  90. file = file2moduleName(file);
  91. specs.push(file);
  92. }
  93. }
  94. angular.module('grafana', ['ngRoute']);
  95. angular.module('grafana.services', ['ngRoute', '$strap.directives']);
  96. angular.module('grafana.panels', []);
  97. angular.module('grafana.filters', []);
  98. angular.module('grafana.routes', ['ngRoute']);
  99. require(specs, function() {
  100. window.__karma__.start();
  101. });
  102. });