mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
e8a895d58b
- using grunt-newer to prefix precommit tasks - only got it to work for tslint and tsc Not applied to: - sasslint does not take the file arguments in a way that grunt-newer recognizes - no-only-tests throws an error when used with `newer`, but it's sub-second runtime
39 lines
849 B
JavaScript
39 lines
849 B
JavaScript
// Lint and build CSS
|
|
module.exports = function (grunt) {
|
|
'use strict';
|
|
|
|
grunt.registerTask('default', [
|
|
'clean:build',
|
|
'phantomjs',
|
|
'webpack:dev',
|
|
]);
|
|
|
|
grunt.registerTask('test', [
|
|
'sasslint',
|
|
'exec:tslint',
|
|
"exec:jest",
|
|
'no-only-tests'
|
|
]);
|
|
|
|
grunt.registerTask('precommit', [
|
|
'sasslint',
|
|
'newer:exec:tslint',
|
|
'newer:exec:tsc',
|
|
'no-only-tests'
|
|
]);
|
|
|
|
grunt.registerTask('no-only-tests', function () {
|
|
var files = grunt.file.expand('public/**/*_specs\.ts', 'public/**/*_specs\.js');
|
|
|
|
files.forEach(function (spec) {
|
|
var rows = grunt.file.read(spec).split('\n');
|
|
rows.forEach(function (row) {
|
|
if (row.indexOf('.only(') > 0) {
|
|
grunt.log.errorlns(row);
|
|
grunt.fail.warn('found only statement in test: ' + spec)
|
|
}
|
|
});
|
|
});
|
|
});
|
|
};
|