mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 15:45:43 -06:00
Allow for plugin testing.
With this change in place you can include plugin specs in `grunt test` by creating a `src/config.js` like that includes something like this: ```js plugins: { // list of plugin panels panels: [], // requirejs modules in plugins folder that should be loaded // for example custom datasources dependencies: ['grafana-plugins/atlasDatasource'], specs: ['grafana-plugins/specs/atlasDatasource-specs'] } ```
This commit is contained in:
parent
32ae0ea13e
commit
85e50ece2e
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'panels/graph/module'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'angular',
|
||||
'jquery',
|
||||
'components/timeSeries',
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'services/graphite/graphiteDatasource'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'services/graphite/gfunc',
|
||||
'controllers/graphiteTarget'
|
||||
], function(helpers, gfunc) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'services/influxdb/influxdbDatasource'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'controllers/row'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'panels/graph/seriesOverridesCtrl'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
@ -1,5 +1,5 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'controllers/sharePanelCtrl'
|
||||
], function(helpers) {
|
||||
'use strict';
|
||||
|
@ -1,6 +1,6 @@
|
||||
define([
|
||||
'mocks/dashboard-mock',
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'moment',
|
||||
'services/templateValuesSrv'
|
||||
], function(dashboardMock, helpers, moment) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
define([
|
||||
'mocks/dashboard-mock',
|
||||
'./helpers',
|
||||
'helpers',
|
||||
'lodash',
|
||||
'services/timeSrv'
|
||||
], function(dashboardMock, helpers, _) {
|
||||
|
@ -4,7 +4,8 @@ require.config({
|
||||
paths: {
|
||||
specs: '../test/specs',
|
||||
mocks: '../test/mocks',
|
||||
config: '../config.sample',
|
||||
helpers: '../test/specs/helpers',
|
||||
config: ['../config', '../config.sample'],
|
||||
kbn: 'components/kbn',
|
||||
store: 'components/store',
|
||||
|
||||
@ -96,9 +97,10 @@ require.config({
|
||||
|
||||
require([
|
||||
'angular',
|
||||
'config',
|
||||
'angularMocks',
|
||||
'app',
|
||||
], function(angular) {
|
||||
], function(angular, config) {
|
||||
'use strict';
|
||||
|
||||
for (var file in window.__karma__.files) {
|
||||
@ -113,7 +115,7 @@ require([
|
||||
angular.module('grafana.panels', []);
|
||||
angular.module('grafana.filters', []);
|
||||
|
||||
require([
|
||||
var specs = [
|
||||
'specs/lexer-specs',
|
||||
'specs/parser-specs',
|
||||
'specs/gfunc-specs',
|
||||
@ -135,9 +137,14 @@ require([
|
||||
'specs/kbn-format-specs',
|
||||
'specs/dashboardSrv-specs',
|
||||
'specs/dashboardViewStateSrv-specs'
|
||||
], function () {
|
||||
window.__karma__.start();
|
||||
];
|
||||
|
||||
var pluginSpecs = (config.plugins.specs || []).map(function (spec) {
|
||||
return '../plugins/' + spec;
|
||||
});
|
||||
|
||||
require(specs.concat(pluginSpecs), function () {
|
||||
window.__karma__.start();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -3,6 +3,7 @@ module.exports = function(config) {
|
||||
src: [
|
||||
'Gruntfile.js',
|
||||
'<%= srcDir %>/app/**/*.js',
|
||||
'<%= srcDir %>/plugins/**/*.js',
|
||||
'!<%= srcDir %>/app/panels/*/{lib,leaflet}/*',
|
||||
'!<%= srcDir %>/app/dashboards/*'
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user