mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(systemjs): almost all tests are passing
This commit is contained in:
6
public/test/specs/helpers.d.ts
vendored
Normal file
6
public/test/specs/helpers.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
declare module "test/specs/helpers" {
|
||||
let helpers: any;
|
||||
export default helpers;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'app/features/dashboard/rowCtrl'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
||||
describe('RowCtrl', function() {
|
||||
var ctx = new helpers.ControllerTestContext();
|
||||
|
||||
beforeEach(module('grafana.controllers'));
|
||||
|
||||
beforeEach(ctx.providePhase());
|
||||
beforeEach(ctx.createControllerPhase('RowCtrl'));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
// Tun on full stack traces in errors to help debugging
|
||||
Error.stackTraceLimit=Infinity;
|
||||
|
||||
window.__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
baseURL: '/base/',
|
||||
defaultJSExtensions: true,
|
||||
@@ -49,7 +54,7 @@
|
||||
deps: ['jquery'],
|
||||
exports: 'angular',
|
||||
},
|
||||
'vendor/angular/angular-mocks.js': {
|
||||
'vendor/angular-mocks/angular-mocks.js': {
|
||||
format: 'global',
|
||||
deps: ['angular'],
|
||||
}
|
||||
@@ -63,23 +68,24 @@
|
||||
}
|
||||
|
||||
function onlySpecFiles(path) {
|
||||
return /_specs\.js$/.test(path);
|
||||
return /specs.*/.test(path);
|
||||
}
|
||||
|
||||
window.grafanaBootData = {settings: {}};
|
||||
|
||||
var modules = ['lodash', 'angular', 'angular-mocks', 'app/app'];
|
||||
var modules = ['angular', 'angular-mocks', 'app/app'];
|
||||
var promises = modules.map(function(name) {
|
||||
return System.import(name);
|
||||
});
|
||||
|
||||
Promise.all(
|
||||
modules.map(function(moduleName) {
|
||||
return System.import(moduleName);
|
||||
})
|
||||
).then(function(deps) {
|
||||
var angular = deps[1];
|
||||
Promise.all(promises).then(function(deps) {
|
||||
var angular = deps[0];
|
||||
|
||||
angular.module('grafana', ['ngRoute']);
|
||||
angular.module('grafana.services', ['ngRoute', '$strap.directives']);
|
||||
angular.module('grafana.panels', []);
|
||||
angular.module('grafana.controllers', []);
|
||||
angular.module('grafana.directives', []);
|
||||
angular.module('grafana.filters', []);
|
||||
angular.module('grafana.routes', ['ngRoute']);
|
||||
|
||||
@@ -89,12 +95,15 @@
|
||||
.filter(onlySpecFiles)
|
||||
.map(file2moduleName)
|
||||
.map(function(path) {
|
||||
console.log(path);
|
||||
return System.import(path);
|
||||
}));
|
||||
}).then(function() {
|
||||
window.__karma__.start();
|
||||
}, function(error) {
|
||||
window.__karma__.error(error.stack || error);
|
||||
}).catch(function(error) {
|
||||
window.__karma__.error(error.stack || error);
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user