test-main.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. 'tether': 'vendor/npm/tether/dist/js/tether.js',
  11. 'tether-drop': 'vendor/npm/tether-drop/dist/js/drop.js',
  12. 'moment': 'vendor/moment.js',
  13. "jquery": "vendor/jquery/dist/jquery.js",
  14. 'lodash-src': 'vendor/lodash.js',
  15. "lodash": 'app/core/lodash_extended.js',
  16. "angular": 'vendor/angular/angular.js',
  17. 'angular-mocks': 'vendor/angular-mocks/angular-mocks.js',
  18. "bootstrap": "vendor/bootstrap/bootstrap.js",
  19. 'angular-route': 'vendor/angular-route/angular-route.js',
  20. 'angular-sanitize': 'vendor/angular-sanitize/angular-sanitize.js',
  21. "angular-ui": "vendor/angular-ui/ui-bootstrap-tpls.js",
  22. "angular-strap": "vendor/angular-other/angular-strap.js",
  23. "angular-dragdrop": "vendor/angular-native-dragdrop/draganddrop.js",
  24. "angular-bindonce": "vendor/angular-bindonce/bindonce.js",
  25. "spectrum": "vendor/spectrum.js",
  26. "bootstrap-tagsinput": "vendor/tagsinput/bootstrap-tagsinput.js",
  27. "jquery.flot": "vendor/flot/jquery.flot",
  28. "jquery.flot.pie": "vendor/flot/jquery.flot.pie",
  29. "jquery.flot.selection": "vendor/flot/jquery.flot.selection",
  30. "jquery.flot.stack": "vendor/flot/jquery.flot.stack",
  31. "jquery.flot.stackpercent": "vendor/flot/jquery.flot.stackpercent",
  32. "jquery.flot.time": "vendor/flot/jquery.flot.time",
  33. "jquery.flot.crosshair": "vendor/flot/jquery.flot.crosshair",
  34. "jquery.flot.fillbelow": "vendor/flot/jquery.flot.fillbelow"
  35. },
  36. packages: {
  37. app: {
  38. defaultExtension: 'js',
  39. },
  40. vendor: {
  41. defaultExtension: 'js',
  42. },
  43. },
  44. map: {
  45. },
  46. meta: {
  47. 'vendor/angular/angular.js': {
  48. format: 'global',
  49. deps: ['jquery'],
  50. exports: 'angular',
  51. },
  52. 'vendor/angular-mocks/angular-mocks.js': {
  53. format: 'global',
  54. deps: ['angular'],
  55. }
  56. }
  57. });
  58. function file2moduleName(filePath) {
  59. return filePath.replace(/\\/g, '/')
  60. .replace(/^\/base\//, '')
  61. .replace(/\.\w*$/, '');
  62. }
  63. function onlySpecFiles(path) {
  64. return /specs.*/.test(path);
  65. }
  66. window.grafanaBootData = {settings: {}};
  67. var modules = ['angular', 'angular-mocks', 'app/app'];
  68. var promises = modules.map(function(name) {
  69. return System.import(name);
  70. });
  71. Promise.all(promises).then(function(deps) {
  72. var angular = deps[0];
  73. angular.module('grafana', ['ngRoute']);
  74. angular.module('grafana.services', ['ngRoute', '$strap.directives']);
  75. angular.module('grafana.panels', []);
  76. angular.module('grafana.controllers', []);
  77. angular.module('grafana.directives', []);
  78. angular.module('grafana.filters', []);
  79. angular.module('grafana.routes', ['ngRoute']);
  80. // load specs
  81. return Promise.all(
  82. Object.keys(window.__karma__.files) // All files served by Karma.
  83. .filter(onlySpecFiles)
  84. .map(file2moduleName)
  85. .map(function(path) {
  86. // console.log(path);
  87. return System.import(path);
  88. }));
  89. }).then(function() {
  90. window.__karma__.start();
  91. }, function(error) {
  92. window.__karma__.error(error.stack || error);
  93. }).catch(function(error) {
  94. window.__karma__.error(error.stack || error);
  95. });
  96. })();