Skip to content

Commit 4522b02

Browse files
committed
tech(systemjs): almost all tests are passing
1 parent f788888 commit 4522b02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+10429
-222
lines changed

karma.conf.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ module.exports = function(config) {
99
// list of files / patterns to load in the browser
1010
files: [
1111
'vendor/npm/es5-shim/es5-shim.js',
12+
'vendor/npm/es5-shim/es5-sham.js',
1213
'vendor/npm/es6-shim/es6-shim.js',
1314
'vendor/npm/es6-promise/dist/es6-promise.js',
1415
'vendor/npm/systemjs/dist/system.src.js',
1516
'test/test-main.js',
1617

17-
{pattern: 'app/**/*.js', included: false},
18-
{pattern: 'vendor/**/*.js', included: false},
19-
{pattern: 'test/**/*.js', included: false}
18+
{pattern: '**/*.js', included: false},
2019
],
2120

2221
// list of files to exclude
@@ -28,7 +27,7 @@ module.exports = function(config) {
2827
logLevel: config.LOG_INFO,
2928
autoWatch: true,
3029
browsers: ['PhantomJS'],
31-
captureTimeout: 60000,
30+
captureTimeout: 2000,
3231
singleRun: true,
3332
autoWatchBatchDelay: 1000,
3433

package.json

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,36 @@
1818
"grunt": "~0.4.0",
1919
"grunt-angular-templates": "^0.5.5",
2020
"grunt-cli": "~0.1.13",
21-
"grunt-contrib-clean": "~0.5.0",
22-
"grunt-contrib-compress": "~0.13.0",
23-
"grunt-contrib-concat": "^0.4.0",
24-
"grunt-contrib-connect": "~0.5.0",
25-
"grunt-contrib-copy": "~0.5.0",
26-
"grunt-contrib-cssmin": "~0.6.1",
21+
"grunt-contrib-clean": "~0.7.0",
22+
"grunt-contrib-compress": "~0.14.0",
23+
"grunt-contrib-concat": "^0.5.1",
24+
"grunt-contrib-copy": "~0.8.2",
25+
"grunt-contrib-cssmin": "~0.14.0",
2726
"grunt-contrib-htmlmin": "~0.6.0",
28-
"grunt-contrib-jshint": "~0.10.0",
27+
"grunt-contrib-jshint": "~0.11.3",
2928
"grunt-contrib-less": "~0.7.0",
30-
"grunt-contrib-requirejs": "~0.4.4",
31-
"grunt-contrib-uglify": "~0.8.0",
29+
"grunt-contrib-uglify": "~0.11.0",
3230
"grunt-contrib-watch": "^0.6.1",
3331
"grunt-filerev": "^0.2.1",
3432
"grunt-git-describe": "~2.3.2",
35-
"grunt-karma": "~0.8.3",
36-
"grunt-ng-annotate": "^0.9.2",
37-
"grunt-string-replace": "~0.2.4",
33+
"grunt-karma": "~0.12.1",
34+
"grunt-ng-annotate": "^1.0.1",
35+
"grunt-string-replace": "~1.2.1",
3836
"grunt-systemjs-builder": "^0.2.5",
3937
"grunt-tslint": "^2.5.0",
4038
"grunt-typescript": "^0.8.0",
4139
"grunt-usemin": "3.0.0",
4240
"jshint-stylish": "~0.1.5",
43-
"karma": "~0.12.31",
44-
"karma-chrome-launcher": "~0.1.4",
45-
"karma-coffee-preprocessor": "~0.1.2",
46-
"karma-coverage": "0.3.1",
47-
"karma-coveralls": "0.1.5",
41+
"karma": "~0.13.15",
42+
"karma-chrome-launcher": "~0.2.2",
43+
"karma-coverage": "0.5.3",
44+
"karma-coveralls": "1.1.2",
4845
"karma-expect": "~1.1.0",
49-
"karma-mocha": "~0.1.10",
50-
"karma-phantomjs-launcher": "0.1.4",
51-
"karma-requirejs": "0.2.2",
52-
"karma-script-launcher": "0.1.0",
53-
"load-grunt-tasks": "0.2.0",
54-
"mocha": "2.2.4",
46+
"karma-mocha": "~0.2.1",
47+
"karma-phantomjs-launcher": "0.2.1",
48+
"load-grunt-tasks": "3.4.0",
49+
"mocha": "2.3.4",
5550
"reflect-metadata": "0.1.2",
56-
"requirejs": "2.1.17",
57-
"rjs-build-analysis": "0.0.3",
5851
"rxjs": "5.0.0-beta.0",
5952
"systemjs": "0.19.6",
6053
"zone.js": "0.5.10"

public/app/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ define([
33
], function(app) {
44
'use strict';
55
// backward compatability hack;
6-
console.log(app);
76
return app.default;
87
});

public/app/grafana.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ export class GrafanaApp {
2525
ngModuleDependencies: any[];
2626
preBootModules: any[];
2727

28+
constructor() {
29+
this.preBootModules = [];
30+
this.registerFunctions = {};
31+
this.ngModuleDependencies = [];
32+
}
33+
2834
useModule(module) {
2935
if (this.preBootModules) {
3036
this.preBootModules.push(module);
@@ -36,9 +42,6 @@ export class GrafanaApp {
3642
}
3743

3844
init() {
39-
this.registerFunctions = {};
40-
this.preBootModules = [];
41-
4245
var app = angular.module('grafana', []);
4346
app.constant('grafanaVersion', "@grafanaVersion@");
4447

public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
///<amd-dependency path="app/plugins/datasource/cloudwatch/datasource" />
2-
///<amd-dependency path="test/specs/helpers" name="helpers" />
31

2+
import "../datasource";
43
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
5-
import moment = require('moment');
6-
7-
declare var helpers: any;
4+
import moment from 'moment';
5+
import helpers from 'test/specs/helpers';
86

97
describe('CloudWatchDatasource', function() {
108
var ctx = new helpers.ServiceTestContext();
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;

public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
///<amd-dependency path="../datasource" />
2-
///<amd-dependency path="test/specs/helpers" name="helpers" />
31

2+
import "../datasource";
43
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
5-
import moment = require('moment');
6-
import angular = require('angular');
7-
8-
declare var helpers: any;
4+
import moment from 'moment';
5+
import angular from 'angular';
6+
import helpers from 'test/specs/helpers';
97

108
describe('ElasticDatasource', function() {
119
var ctx = new helpers.ServiceTestContext();

public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
///<amd-dependency path="../elastic_response" name="ElasticResponse"/>
21

32
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
4-
5-
declare var ElasticResponse: any;
3+
import ElasticResponse from '../elastic_response';
64

75
describe('ElasticResponse', function() {
86
var targets;

public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
///<amd-dependency path="../index_pattern" name="IndexPattern"/>
21
///<amd-dependency path="test/specs/helpers" name="helpers" />
32

43
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
5-
import moment = require('moment');
6-
7-
declare var IndexPattern: any;
4+
import moment from 'moment';
5+
import IndexPattern from '../index_pattern';
86

97
describe('IndexPattern', function() {
108

public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
///<amd-dependency path="../query_builder" name="ElasticQueryBuilder"/>
21

32
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
4-
5-
declare var ElasticQueryBuilder: any;
3+
import ElasticQueryBuilder from '../query_builder';
64

75
describe('ElasticQueryBuilder', function() {
86
var builder;

public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
///<amd-dependency path="test/specs/helpers" name="helpers" />
44

55
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
6-
7-
declare var helpers: any;
6+
import helpers from 'test/specs/helpers';
87

98
describe('ElasticQueryCtrl', function() {
109
var ctx = new helpers.ControllerTestContext();

public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
///<amd-dependency path="../query_def" name="QueryDef" />
2-
///<amd-dependency path="test/specs/helpers" name="helpers" />
31

42
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
53

6-
declare var helpers: any;
7-
declare var QueryDef: any;
4+
import * as queryDef from '../query_def';
85

96
describe('ElasticQueryDef', function() {
107

118
describe('getPipelineAggOptions', function() {
129
describe('with zero targets', function() {
13-
var response = QueryDef.getPipelineAggOptions([]);
10+
var response = queryDef.getPipelineAggOptions([]);
1411

1512
it('should return zero', function() {
1613
expect(response.length).to.be(0);
@@ -25,7 +22,7 @@ describe('ElasticQueryDef', function() {
2522
]
2623
};
2724

28-
var response = QueryDef.getPipelineAggOptions(targets);
25+
var response = queryDef.getPipelineAggOptions(targets);
2926

3027
it('should return zero', function() {
3128
expect(response.length).to.be(2);
@@ -40,7 +37,7 @@ describe('ElasticQueryDef', function() {
4037
]
4138
};
4239

43-
var response = QueryDef.getPipelineAggOptions(targets);
40+
var response = queryDef.getPipelineAggOptions(targets);
4441

4542
it('should return one', function() {
4643
expect(response.length).to.be(1);
@@ -54,7 +51,7 @@ describe('ElasticQueryDef', function() {
5451
]
5552
};
5653

57-
var response = QueryDef.getPipelineAggOptions(targets);
54+
var response = queryDef.getPipelineAggOptions(targets);
5855

5956
it('should return zero', function() {
6057
expect(response.length).to.be(0);
@@ -64,15 +61,15 @@ describe('ElasticQueryDef', function() {
6461

6562
describe('isPipelineMetric', function() {
6663
describe('moving_avg', function() {
67-
var result = QueryDef.isPipelineAgg('moving_avg');
64+
var result = queryDef.isPipelineAgg('moving_avg');
6865

6966
it('is pipe line metric', function() {
7067
expect(result).to.be(true);
7168
});
7269
});
7370

7471
describe('count', function() {
75-
var result = QueryDef.isPipelineAgg('count');
72+
var result = queryDef.isPipelineAgg('count');
7673

7774
it('is not pipe line metric', function() {
7875
expect(result).to.be(false);
@@ -83,19 +80,19 @@ describe('ElasticQueryDef', function() {
8380
describe('pipeline aggs depending on esverison', function() {
8481
describe('using esversion undefined', function() {
8582
it('should not get pipeline aggs', function() {
86-
expect(QueryDef.getMetricAggTypes(undefined).length).to.be(9);
83+
expect(queryDef.getMetricAggTypes(undefined).length).to.be(9);
8784
});
8885
});
8986

9087
describe('using esversion 1', function() {
9188
it('should not get pipeline aggs', function() {
92-
expect(QueryDef.getMetricAggTypes(1).length).to.be(9);
89+
expect(queryDef.getMetricAggTypes(1).length).to.be(9);
9390
});
9491
});
9592

9693
describe('using esversion 2', function() {
9794
it('should get pipeline aggs', function() {
98-
expect(QueryDef.getMetricAggTypes(2).length).to.be(11);
95+
expect(queryDef.getMetricAggTypes(2).length).to.be(11);
9996
});
10097
});
10198
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;

public/app/plugins/datasource/graphite/specs/datasource_specs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
///<amd-dependency path="app/plugins/datasource/graphite/datasource" />
2-
///<amd-dependency path="test/specs/helpers" name="helpers" />
31

2+
import "../datasource";
43
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
5-
declare var helpers: any;
4+
import helpers from 'test/specs/helpers';
65

76
describe('graphiteDatasource', function() {
87
var ctx = new helpers.ServiceTestContext();

public/app/plugins/datasource/graphite/specs/gfunc_specs.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
///<amd-dependency path="app/plugins/datasource/graphite/gfunc" name="gfunc" />
22

33
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
4-
5-
declare var gfunc: any;
4+
import gfunc from '../gfunc';
65

76
describe('when creating func instance from func names', function() {
87
it('should return func instance', function() {

public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
///<amd-dependency path="app/plugins/datasource/graphite/gfunc" name="gfunc"/>
2-
///<amd-dependency path="app/plugins/datasource/graphite/query_ctrl" />
3-
///<amd-dependency path="app/core/services/segment_srv" />
4-
///<amd-dependency path="test/specs/helpers" name="helpers" />
51

2+
import '../query_ctrl';
3+
import 'app/core/services/segment_srv';
64
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
75

8-
declare var gfunc: any;
9-
declare var helpers: any;
6+
import * as gfunc from '../gfunc';
7+
import helpers from 'test/specs/helpers';
108

119
describe('GraphiteQueryCtrl', function() {
1210
var ctx = new helpers.ControllerTestContext();
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var test: any;
2+
export default test;

public/app/plugins/datasource/influxdb/query_ctrl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) {
1111

1212
var module = angular.module('grafana.controllers');
1313

14+
InfluxQuery = InfluxQuery.default;
15+
queryPart = queryPart.default;
16+
1417
module.controller('InfluxQueryCtrl', function($scope, templateSrv, $q, uiSegmentSrv) {
1518

1619
$scope.init = function() {

public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
22

3-
import InfluxQuery = require('../influx_query');
3+
import InfluxQuery from '../influx_query';
44

55
describe('InfluxQuery', function() {
66

public/app/plugins/datasource/influxdb/specs/influx_series_specs.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
///<amd-dependency path="app/plugins/datasource/influxdb/influx_series" name="InfluxSeries"/>
2-
31
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
4-
5-
declare var InfluxSeries: any;
2+
import InfluxSeries from '../influx_series';
63

74
describe('when generating timeseries from influxdb response', function() {
85

public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
///<amd-dependency path="app/plugins/datasource/influxdb/query_builder" name="InfluxQueryBuilder"/>
2-
31
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
4-
5-
declare var InfluxQueryBuilder: any;
2+
import InfluxQueryBuilder from '../query_builder';
63

74
describe('InfluxQueryBuilder', function() {
85

public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
///<amd-dependency path="app/plugins/datasource/influxdb/query_ctrl"/>
2-
///<amd-dependency path="app/core/services/segment_srv" />
3-
///<amd-dependency path="test/specs/helpers" name="helpers" />
4-
1+
import '../query_ctrl';
2+
import 'app/core/services/segment_srv';
53
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
6-
7-
declare var helpers: any;
4+
import helpers from 'test/specs/helpers';
85

96
describe('InfluxDBQueryCtrl', function() {
107
var ctx = new helpers.ControllerTestContext();

public/app/plugins/datasource/influxdb/specs/query_part_specs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
33

4-
import queryPart = require('../query_part');
4+
import queryPart from '../query_part';
55

66
describe('InfluxQueryPart', () => {
77

0 commit comments

Comments
 (0)