kibana/x-pack/tasks/test.js
Joe Fleming ef4b694e83
Chore: Reorg the x-pack gulp tasks (#22785)
- Removes deprecated, non-functional lint scripts
- Removes some unused (and barely used) dependencies
- Replaces deprecated `gulp-util` dependency
- Adds eslint rule to prevent future use of deprecated `gulp-util` dependency
- Moves all gulp tasks into `tasks` path
- Moves `gulp_helpers` into `tasks/helpers`
- All tasks in `gulpfile.js` were moved into `tasks` and broken up by domain

This is basically a no-op moving files around PR. All the existing tasks appear to work the same with these changes.

<img width="334" alt="screenshot 2018-09-06 15 42 45" src="https://user-images.githubusercontent.com/404731/45188971-8618c000-b1eb-11e8-9b26-b072ccc7ddb7.png">
2018-09-07 09:43:17 -07:00

55 lines
No EOL
1.5 KiB
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import runSequence from 'run-sequence';
import pluginHelpers from '@kbn/plugin-helpers';
import { getEnabledPlugins } from './helpers/get_plugins';
import { forPluginServerTests } from './helpers/globs';
import { createAutoJUnitReporter } from '../../src/dev';
const MOCHA_OPTIONS = {
ui: 'bdd',
reporter: createAutoJUnitReporter({
reportName: 'X-Pack Mocha Tests',
rootDirectory: __dirname,
}),
};
export default (gulp, { mocha }) => {
gulp.task('test', (cb) => {
const preTasks = ['clean-test'];
runSequence(preTasks, 'testserver', 'testbrowser', cb);
});
gulp.task('testonly', ['testserver', 'testbrowser']);
gulp.task('testserver', () => {
const globs = [
'common/**/__tests__/**/*.js',
'server/**/__tests__/**/*.js',
].concat(forPluginServerTests());
return gulp.src(globs, { read: false })
.pipe(mocha(MOCHA_OPTIONS));
});
gulp.task('testbrowser', () => {
return getEnabledPlugins().then(plugins => {
return pluginHelpers.run('testBrowser', {
plugins: plugins.join(','),
});
});
});
gulp.task('testbrowser-dev', () => {
return getEnabledPlugins().then(plugins => {
return pluginHelpers.run('testBrowser', {
dev: true,
plugins: plugins.join(','),
});
});
});
};