grafana/scripts/grunt/default_task.js

59 lines
1.4 KiB
JavaScript
Raw Normal View History

2013-11-15 07:07:14 +08:00
// Lint and build CSS
module.exports = function(grunt) {
2015-09-10 17:26:40 +08:00
'use strict';
// prettier-ignore
2015-09-10 17:26:40 +08:00
grunt.registerTask('default', [
'clean:build',
'phantomjs',
]);
// prettier-ignore
grunt.registerTask('test', [
'sasslint',
2018-12-21 21:37:38 +08:00
'tslint',
'typecheck',
'exec:jest',
'no-only-tests',
'no-focus-convey-tests'
2015-09-10 17:26:40 +08:00
]);
// prettier-ignore
grunt.registerTask('tslint', [
'newer:exec:tslintPackages',
'newer:exec:tslintRoot'
]);
// prettier-ignore
grunt.registerTask('typecheck', [
'newer:exec:typecheckPackages',
'newer:exec:typecheckRoot'
]);
grunt.registerTask('no-only-tests', function() {
2019-03-18 17:39:14 +08:00
var files = grunt.file.expand(
'public/**/*@(_specs|.test).@(ts|js|tsx|jsx)',
'packages/grafana-data/**/*@(_specs|.test).@(ts|js|tsx|jsx)',
'packages/**/*@(_specs|.test).@(ts|js|tsx|jsx)'
2019-03-18 17:39:14 +08:00
);
grepFiles(files, '.only(', 'found only statement in test: ');
});
grunt.registerTask('no-focus-convey-tests', function() {
var files = grunt.file.expand('pkg/**/*_test.go');
grepFiles(files, 'FocusConvey(', 'found FocusConvey statement in test: ');
});
function grepFiles(files, pattern, errorMessage) {
files.forEach(function(spec) {
var rows = grunt.file.read(spec).split('\n');
rows.forEach(function(row) {
if (row.indexOf(pattern) > 0) {
grunt.log.errorlns(row);
grunt.fail.warn(errorMessage + spec);
}
});
});
}
2014-05-31 13:46:39 +08:00
};