kibana/tasks/test.js

118 lines
2.5 KiB
JavaScript
Raw Normal View History

import _, { keys } from 'lodash';
import visualRegression from '../utilities/visual_regression';
module.exports = function (grunt) {
grunt.registerTask(
'test:visualRegression:buildGallery',
'Compare screenshots and generate diff images.',
function () {
const done = this.async();
visualRegression.run(done);
}
);
grunt.registerTask('test:server', [
'checkPlugins',
'esvm:test',
'simplemocha:all',
'esvm_shutdown:test',
]);
grunt.registerTask('test:browser', [
'checkPlugins',
'run:testServer',
'karma:unit',
]);
grunt.registerTask('test:browser-ci', () => {
const ciShardTasks = keys(grunt.config.get('karma'))
.filter(key => key.startsWith('ciShard-'))
.map(key => `karma:${key}`);
grunt.log.ok(`Running UI tests in ${ciShardTasks.length} shards`);
grunt.task.run([
'run:testServer',
...ciShardTasks
]);
});
2015-08-25 02:10:21 +02:00
grunt.registerTask('test:coverage', [ 'run:testCoverageServer', 'karma:coverage' ]);
grunt.registerTask('test:quick', [
'test:server',
'test:ui',
2017-04-06 03:24:01 +02:00
'test:jest',
'test:browser',
'test:api'
]);
grunt.registerTask('test:dev', [
'checkPlugins',
'run:devTestServer',
'karma:dev'
]);
grunt.registerTask('test:ui', [
'checkPlugins',
'esvm:ui',
'run:testUIServer',
'clean:screenshots',
[functionalTestRunner] replace intern (#10910) * [functional_test_runner] replace functional testing tools with custom/pluggable solution * [functional_test_runner] Convert unit tests to commonjs format * [functional_test_runner] Fix dashboard test in wrong mode * [functional_test_runner] Add dashboardLandingPage test subject * [functional_test_runner] Get Visualize page object * [functional_test_runner] Fix outdated references * [functional_test_runner] Fix more outdated refs * [functional_test_runner] Remove duplicate tests * [functional_test_runner] Improve test readability * [functional_test_runner] :disappointed: So many duplicate methods * [functional_test_runner] Move mgmt `before` outside toplevel describe * [functional_test_runner] Settings page obj missing methods * [functional_test_runner] Add improvements from @gammon * [functional_test_runner] Fix return statements in async funcs * [functional_test_runner] Move before() to correct scope * [functional_test_runner] Add after() hooks to remove index patterns * [functional_test_runner] Attempt to fix vertical bar chart tests * [functional_test_runner] Clean up * [functional_test_runner] Reinstate unit tests * [functional_test_runner] Set default loglevel back to info * [functional_test_runner] Replace `context`s with `describe`s * [functional_test_runner] Better error handling * [functional_test_runner] Add in new Tile Map tests * Incorporate changes from master * [functional_test_runner] validate that every test file has a single top-level suite * Update contributing doc with link to full doc * [docs] Spelling and grammar fixes * docs: writing and running functional tests * [docs] Move plugin doc to plugin area * [docs] Housekeeping. Doc in wrong place * [docs] Remove dup doc file * [grunt] Only run mocha_setup when running tests, not every grunt task
2017-04-12 00:01:06 +02:00
'functionalTestRunner',
'esvm_shutdown:ui',
'stop:testUIServer'
]);
grunt.registerTask('test:uiRelease', [
'checkPlugins',
'esvm:ui',
'run:testUIReleaseServer',
'clean:screenshots',
'functionalTestRunner',
'esvm_shutdown:ui',
'stop:testUIReleaseServer'
]);
2015-09-11 21:08:35 +02:00
grunt.registerTask('test:ui:server', [
'checkPlugins',
2015-09-11 21:08:35 +02:00
'esvm:ui',
'run:testUIDevServer:keepalive'
2015-09-11 21:08:35 +02:00
]);
grunt.registerTask('test:ui:runner', [
'checkPlugins',
'clean:screenshots',
[functionalTestRunner] replace intern (#10910) * [functional_test_runner] replace functional testing tools with custom/pluggable solution * [functional_test_runner] Convert unit tests to commonjs format * [functional_test_runner] Fix dashboard test in wrong mode * [functional_test_runner] Add dashboardLandingPage test subject * [functional_test_runner] Get Visualize page object * [functional_test_runner] Fix outdated references * [functional_test_runner] Fix more outdated refs * [functional_test_runner] Remove duplicate tests * [functional_test_runner] Improve test readability * [functional_test_runner] :disappointed: So many duplicate methods * [functional_test_runner] Move mgmt `before` outside toplevel describe * [functional_test_runner] Settings page obj missing methods * [functional_test_runner] Add improvements from @gammon * [functional_test_runner] Fix return statements in async funcs * [functional_test_runner] Move before() to correct scope * [functional_test_runner] Add after() hooks to remove index patterns * [functional_test_runner] Attempt to fix vertical bar chart tests * [functional_test_runner] Clean up * [functional_test_runner] Reinstate unit tests * [functional_test_runner] Set default loglevel back to info * [functional_test_runner] Replace `context`s with `describe`s * [functional_test_runner] Better error handling * [functional_test_runner] Add in new Tile Map tests * Incorporate changes from master * [functional_test_runner] validate that every test file has a single top-level suite * Update contributing doc with link to full doc * [docs] Spelling and grammar fixes * docs: writing and running functional tests * [docs] Move plugin doc to plugin area * [docs] Housekeeping. Doc in wrong place * [docs] Remove dup doc file * [grunt] Only run mocha_setup when running tests, not every grunt task
2017-04-12 00:01:06 +02:00
'functionalTestRunner'
2015-09-11 21:08:35 +02:00
]);
2015-11-17 19:01:45 +01:00
grunt.registerTask('test:api', [
'esvm:ui',
'run:apiTestServer',
[functionalTestRunner] replace intern (#10910) * [functional_test_runner] replace functional testing tools with custom/pluggable solution * [functional_test_runner] Convert unit tests to commonjs format * [functional_test_runner] Fix dashboard test in wrong mode * [functional_test_runner] Add dashboardLandingPage test subject * [functional_test_runner] Get Visualize page object * [functional_test_runner] Fix outdated references * [functional_test_runner] Fix more outdated refs * [functional_test_runner] Remove duplicate tests * [functional_test_runner] Improve test readability * [functional_test_runner] :disappointed: So many duplicate methods * [functional_test_runner] Move mgmt `before` outside toplevel describe * [functional_test_runner] Settings page obj missing methods * [functional_test_runner] Add improvements from @gammon * [functional_test_runner] Fix return statements in async funcs * [functional_test_runner] Move before() to correct scope * [functional_test_runner] Add after() hooks to remove index patterns * [functional_test_runner] Attempt to fix vertical bar chart tests * [functional_test_runner] Clean up * [functional_test_runner] Reinstate unit tests * [functional_test_runner] Set default loglevel back to info * [functional_test_runner] Replace `context`s with `describe`s * [functional_test_runner] Better error handling * [functional_test_runner] Add in new Tile Map tests * Incorporate changes from master * [functional_test_runner] validate that every test file has a single top-level suite * Update contributing doc with link to full doc * [docs] Spelling and grammar fixes * docs: writing and running functional tests * [docs] Move plugin doc to plugin area * [docs] Housekeeping. Doc in wrong place * [docs] Remove dup doc file * [grunt] Only run mocha_setup when running tests, not every grunt task
2017-04-12 00:01:06 +02:00
'simplemocha:api',
2015-11-17 19:01:45 +01:00
'esvm_shutdown:ui',
'stop:apiTestServer'
]);
grunt.registerTask('test:api:server', [
'esvm:ui',
'run:apiTestServer:keepalive'
]);
grunt.registerTask('test:api:runner', [
[functionalTestRunner] replace intern (#10910) * [functional_test_runner] replace functional testing tools with custom/pluggable solution * [functional_test_runner] Convert unit tests to commonjs format * [functional_test_runner] Fix dashboard test in wrong mode * [functional_test_runner] Add dashboardLandingPage test subject * [functional_test_runner] Get Visualize page object * [functional_test_runner] Fix outdated references * [functional_test_runner] Fix more outdated refs * [functional_test_runner] Remove duplicate tests * [functional_test_runner] Improve test readability * [functional_test_runner] :disappointed: So many duplicate methods * [functional_test_runner] Move mgmt `before` outside toplevel describe * [functional_test_runner] Settings page obj missing methods * [functional_test_runner] Add improvements from @gammon * [functional_test_runner] Fix return statements in async funcs * [functional_test_runner] Move before() to correct scope * [functional_test_runner] Add after() hooks to remove index patterns * [functional_test_runner] Attempt to fix vertical bar chart tests * [functional_test_runner] Clean up * [functional_test_runner] Reinstate unit tests * [functional_test_runner] Set default loglevel back to info * [functional_test_runner] Replace `context`s with `describe`s * [functional_test_runner] Better error handling * [functional_test_runner] Add in new Tile Map tests * Incorporate changes from master * [functional_test_runner] validate that every test file has a single top-level suite * Update contributing doc with link to full doc * [docs] Spelling and grammar fixes * docs: writing and running functional tests * [docs] Move plugin doc to plugin area * [docs] Housekeeping. Doc in wrong place * [docs] Remove dup doc file * [grunt] Only run mocha_setup when running tests, not every grunt task
2017-04-12 00:01:06 +02:00
'simplemocha:api'
2015-11-17 19:01:45 +01:00
]);
grunt.registerTask('test', subTask => {
if (subTask) grunt.fail.fatal(`invalid task "test:${subTask}"`);
2015-07-28 02:13:45 +02:00
grunt.task.run(_.compact([
!grunt.option('quick') && 'eslint:source',
2016-05-02 18:55:55 +02:00
'licenses',
'test:quick'
2015-07-28 02:13:45 +02:00
]));
});
grunt.registerTask('quick-test', ['test:quick']); // historical alias
};