mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Merge pull request elastic/kibana-plugin-helpers#22 from elastic/enh/test-all-task
Add test task Original commit: elastic/kibana-plugin-helpers@63e507b3ff
This commit is contained in:
commit
be64fe21a4
7 changed files with 27 additions and 5 deletions
|
@ -24,8 +24,15 @@ program
|
|||
.on('--help', docs('build'))
|
||||
.action(run('build'));
|
||||
|
||||
program
|
||||
.command('test')
|
||||
.description('Run the server and browser tests')
|
||||
.on('--help', docs('test/all'))
|
||||
.action(run('test/all'));
|
||||
|
||||
program
|
||||
.command('test:browser')
|
||||
.option('--dev', 'Enable dev mode, keeps the test server running')
|
||||
.description('Run the browser tests in a real web browser')
|
||||
.on('--help', docs('test/browser'))
|
||||
.action(run('test/browser'));
|
||||
|
|
|
@ -6,6 +6,6 @@ module.exports = function run(name) {
|
|||
// call the action function with the plugin, then all
|
||||
// renaining arguments from commander
|
||||
var plugin = pluginConfig();
|
||||
action.apply(null, [plugin].concat([].slice.apply(arguments)));
|
||||
action.apply(null, [plugin, run].concat([].slice.apply(arguments)));
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
module.exports = function (plugin, command) {
|
||||
module.exports = function (plugin, run, command) {
|
||||
var execFileSync = require('child_process').execFileSync;
|
||||
|
||||
var cmd = (process.platform === 'win32') ? 'bin\\kibana.bat' : 'bin/kibana';
|
||||
var args = ['--dev', '--plugin-path', plugin.root, ...command.unkownOptions];
|
||||
var args = ['--dev', '--plugin-path', plugin.root];
|
||||
|
||||
if (command.unkownOptions) {
|
||||
args = args.concat(command.unkownOptions);
|
||||
}
|
||||
|
||||
execFileSync(cmd, args, {
|
||||
cwd: plugin.kibanaRoot,
|
||||
stdio: ['ignore', 1, 2]
|
||||
|
|
3
packages/kbn-plugin-helpers/tasks/test/all/README.md
Normal file
3
packages/kbn-plugin-helpers/tasks/test/all/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Runs both the server and browser tests, in that order.
|
||||
|
||||
This is just a simple caller to both `test/server` and `test/browser`
|
1
packages/kbn-plugin-helpers/tasks/test/all/index.js
Normal file
1
packages/kbn-plugin-helpers/tasks/test/all/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./test_all_action');
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function testAllAction(plugin, run) {
|
||||
run('test/server')();
|
||||
run('test/browser')();
|
||||
};
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = function (plugin) {
|
||||
module.exports = function testBrowserAction(plugin, run, command) {
|
||||
var execFileSync = require('child_process').execFileSync;
|
||||
command = command || {};
|
||||
|
||||
var kbnServerArgs = [
|
||||
'--kbnServer.testsBundle.pluginId=' + plugin.id,
|
||||
|
@ -7,7 +8,8 @@ module.exports = function (plugin) {
|
|||
];
|
||||
|
||||
var cmd = 'npm';
|
||||
var args = ['run', 'test:dev', '--'].concat(kbnServerArgs);
|
||||
var task = (command.dev) ? 'test:dev' : 'test:browser';
|
||||
var args = ['run', task, '--'].concat(kbnServerArgs);
|
||||
execFileSync(cmd, args, {
|
||||
cwd: plugin.kibanaRoot,
|
||||
stdio: ['ignore', 1, 2]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue