test-main.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. (function() {
  2. "use strict";
  3. // Tun on full stack traces in errors to help debugging
  4. Error.stackTraceLimit=Infinity;
  5. window.__karma__.loaded = function() {};
  6. System.config({
  7. baseURL: '/base/',
  8. defaultJSExtensions: true,
  9. paths: {
  10. 'gemini-scrollbar': 'vendor/npm/gemini-scrollbar/index.js',
  11. 'mousetrap': 'vendor/npm/mousetrap/mousetrap.js',
  12. 'eventemitter3': 'vendor/npm/eventemitter3/index.js',
  13. 'remarkable': 'vendor/npm/remarkable/dist/remarkable.js',
  14. 'tether': 'vendor/npm/tether/dist/js/tether.js',
  15. 'tether-drop': 'vendor/npm/tether-drop/dist/js/drop.js',
  16. 'moment': 'vendor/moment.js',
  17. "jquery": "vendor/jquery/dist/jquery.js",
  18. 'lodash-src': 'vendor/lodash/dist/lodash.js',
  19. "lodash": 'app/core/lodash_extended.js',
  20. "angular": 'vendor/angular/angular.js',
  21. 'angular-mocks': 'vendor/angular-mocks/angular-mocks.js',
  22. "bootstrap": "vendor/bootstrap/bootstrap.js",
  23. 'angular-route': 'vendor/angular-route/angular-route.js',
  24. 'angular-sanitize': 'vendor/angular-sanitize/angular-sanitize.js',
  25. "angular-ui": "vendor/angular-ui/ui-bootstrap-tpls.js",
  26. "angular-strap": "vendor/angular-other/angular-strap.js",
  27. "angular-dragdrop": "vendor/angular-native-dragdrop/draganddrop.js",
  28. "angular-bindonce": "vendor/angular-bindonce/bindonce.js",
  29. "spectrum": "vendor/spectrum.js",
  30. "bootstrap-tagsinput": "vendor/tagsinput/bootstrap-tagsinput.js",
  31. "jquery.flot": "vendor/flot/jquery.flot",
  32. "jquery.flot.pie": "vendor/flot/jquery.flot.pie",
  33. "jquery.flot.selection": "vendor/flot/jquery.flot.selection",
  34. "jquery.flot.stack": "vendor/flot/jquery.flot.stack",
  35. "jquery.flot.stackpercent": "vendor/flot/jquery.flot.stackpercent",
  36. "jquery.flot.time": "vendor/flot/jquery.flot.time",
  37. "jquery.flot.crosshair": "vendor/flot/jquery.flot.crosshair",
  38. "jquery.flot.fillbelow": "vendor/flot/jquery.flot.fillbelow",
  39. "jquery.flot.gauge": "vendor/flot/jquery.flot.gauge",
  40. "d3": "vendor/d3/d3.js",
  41. "jquery.flot.dashes": "vendor/flot/jquery.flot.dashes",
  42. "jquery-ui": "vendor/jquery-ui/custom.js",
  43. "gridstack": "vendor/npm/gridstack/dist/gridstack.js",
  44. "gridstack.jquery-ui": "vendor/npm/gridstack/dist/gridstack.jQueryUI.js",
  45. "ace": "vendor/npm/ace-builds/src-noconflict/ace",
  46. },
  47. packages: {
  48. app: {
  49. defaultExtension: 'js',
  50. },
  51. vendor: {
  52. defaultExtension: 'js',
  53. },
  54. },
  55. map: {
  56. },
  57. meta: {
  58. 'vendor/npm/jquery-ui/jquery-ui.js': {
  59. format: 'amd',
  60. deps: ['jquery'],
  61. },
  62. 'vendor/npm/gridstack/dist/gridstack.js': {
  63. format: 'global',
  64. deps: ['jquery', 'jquery-ui', 'lodash'],
  65. },
  66. "vendor/npm/gridstack/dist/gridstack.jQueryUI.js": {
  67. format: 'global',
  68. deps: ['gridstack'],
  69. },
  70. 'vendor/angular/angular.js': {
  71. format: 'global',
  72. deps: ['jquery'],
  73. exports: 'angular',
  74. },
  75. 'vendor/angular-mocks/angular-mocks.js': {
  76. format: 'global',
  77. deps: ['angular'],
  78. },
  79. 'vendor/npm/eventemitter3/index.js': {
  80. format: 'cjs',
  81. exports: 'EventEmitter'
  82. },
  83. 'vendor/npm/mousetrap/mousetrap.js': {
  84. format: 'global',
  85. exports: 'Mousetrap'
  86. },
  87. 'vendor/npm/ace-builds/src-noconflict/ace.js': {
  88. format: 'global',
  89. exports: 'ace'
  90. },
  91. }
  92. });
  93. function file2moduleName(filePath) {
  94. return filePath.replace(/\\/g, '/')
  95. .replace(/^\/base\//, '')
  96. .replace(/\.\w*$/, '');
  97. }
  98. function onlySpecFiles(path) {
  99. return /specs.*/.test(path);
  100. }
  101. window.grafanaBootData = {settings: {}};
  102. var modules = ['angular', 'angular-mocks', 'app/app'];
  103. var promises = modules.map(function(name) {
  104. return System.import(name);
  105. });
  106. Promise.all(promises).then(function(deps) {
  107. var angular = deps[0];
  108. angular.module('grafana', ['ngRoute']);
  109. angular.module('grafana.services', ['ngRoute', '$strap.directives']);
  110. angular.module('grafana.panels', []);
  111. angular.module('grafana.controllers', []);
  112. angular.module('grafana.directives', []);
  113. angular.module('grafana.filters', []);
  114. angular.module('grafana.routes', ['ngRoute']);
  115. // load specs
  116. return Promise.all(
  117. Object.keys(window.__karma__.files) // All files served by Karma.
  118. .filter(onlySpecFiles)
  119. .map(file2moduleName)
  120. .map(function(path) {
  121. // console.log(path);
  122. return System.import(path);
  123. }));
  124. }).then(function() {
  125. window.__karma__.start();
  126. }, function(error) {
  127. window.__karma__.error(error.stack || error);
  128. }).catch(function(error) {
  129. window.__karma__.error(error.stack || error);
  130. });
  131. })();