test-main.js 4.2 KB

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