mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Add task to find FocusConvey tests (#16381)
This commit is contained in:
parent
335aa7c9f2
commit
08ce7f6c93
@ -593,7 +593,7 @@ func TestMySQL(t *testing.T) {
|
||||
So(queryResult.Series[0].Points[0][1].Float64, ShouldEqual, float64(tInitial.UnixNano()/1e6))
|
||||
})
|
||||
|
||||
FocusConvey("When doing a metric query using epoch (int32) as time column and value column (int32) should return metric with time in milliseconds", func() {
|
||||
Convey("When doing a metric query using epoch (int32) as time column and value column (int32) should return metric with time in milliseconds", func() {
|
||||
query := &tsdb.TsdbQuery{
|
||||
Queries: []*tsdb.Query{
|
||||
{
|
||||
|
@ -1,52 +1,68 @@
|
||||
// Lint and build CSS
|
||||
module.exports = function (grunt) {
|
||||
module.exports = function(grunt) {
|
||||
'use strict';
|
||||
|
||||
// prettier-ignore
|
||||
grunt.registerTask('default', [
|
||||
'clean:build',
|
||||
'phantomjs',
|
||||
'webpack:dev',
|
||||
'webpack:dev'
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
grunt.registerTask('test', [
|
||||
'sasslint',
|
||||
'tslint',
|
||||
'typecheck',
|
||||
"exec:jest",
|
||||
'no-only-tests'
|
||||
'exec:jest',
|
||||
'no-only-tests',
|
||||
'no-focus-convey-tests'
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
grunt.registerTask('tslint', [
|
||||
'newer:exec:tslintPackages',
|
||||
'newer:exec:tslintRoot',
|
||||
'newer:exec:tslintRoot'
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
grunt.registerTask('typecheck', [
|
||||
'newer:exec:typecheckPackages',
|
||||
'newer:exec:typecheckRoot',
|
||||
'newer:exec:typecheckRoot'
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
grunt.registerTask('precommit', [
|
||||
'newer:sasslint',
|
||||
'typecheck',
|
||||
'tslint',
|
||||
'no-only-tests'
|
||||
'no-only-tests',
|
||||
'no-focus-convey-tests'
|
||||
]);
|
||||
|
||||
grunt.registerTask('no-only-tests', function () {
|
||||
grunt.registerTask('no-only-tests', function() {
|
||||
var files = grunt.file.expand(
|
||||
'public/**/*@(_specs|\.test)\.@(ts|js|tsx|jsx)',
|
||||
'packages/grafana-ui/**/*@(_specs|\.test)\.@(ts|js|tsx|jsx)'
|
||||
'public/**/*@(_specs|.test).@(ts|js|tsx|jsx)',
|
||||
'packages/grafana-ui/**/*@(_specs|.test).@(ts|js|tsx|jsx)'
|
||||
);
|
||||
grepFiles(files, '.only(', 'found only statement in test: ');
|
||||
});
|
||||
|
||||
files.forEach(function (spec) {
|
||||
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('.only(') > 0) {
|
||||
rows.forEach(function(row) {
|
||||
if (row.indexOf(pattern) > 0) {
|
||||
grunt.log.errorlns(row);
|
||||
grunt.fail.warn('found only statement in test: ' + spec);
|
||||
grunt.fail.warn(errorMessage + spec);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user