mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
make server test files an argument
Original commit: elastic/kibana-plugin-helpers@b043b423ef
This commit is contained in:
parent
01a8fcee35
commit
867ed91517
2 changed files with 4 additions and 11 deletions
|
@ -39,9 +39,8 @@ program
|
|||
.action(run('test/browser'));
|
||||
|
||||
program
|
||||
.command('test:server')
|
||||
.command('test:server [files...]')
|
||||
.description('Run the server tests using mocha')
|
||||
.option('-i, --include <globs>', 'Additional files of glob patterns to include server tests from')
|
||||
.on('--help', docs('test/server'))
|
||||
.action(run('test/server'));
|
||||
|
||||
|
|
|
@ -2,21 +2,15 @@ var resolve = require('path').resolve;
|
|||
var delimiter = require('path').delimiter;
|
||||
var execFileSync = require('child_process').execFileSync;
|
||||
|
||||
module.exports = function (plugin, run, command) {
|
||||
command = command || {};
|
||||
|
||||
module.exports = function (plugin, run, files) {
|
||||
var kibanaBins = resolve(plugin.kibanaRoot, 'node_modules/.bin');
|
||||
var mochaSetupJs = resolve(plugin.kibanaRoot, 'test/mocha_setup.js');
|
||||
|
||||
var cmd = 'mocha';
|
||||
var args = ['--require', mochaSetupJs, 'server/**/__tests__/**/*.js'];
|
||||
var testPaths = (files.length) ? files : 'server/**/__tests__/**/*.js';
|
||||
var args = ['--require', mochaSetupJs].concat(testPaths);
|
||||
var path = `${kibanaBins}${delimiter}${process.env.PATH}`;
|
||||
|
||||
if (command.include) {
|
||||
var globs = command.include.split(',');
|
||||
args = args.concat(globs);
|
||||
}
|
||||
|
||||
execFileSync(cmd, args, {
|
||||
cwd: plugin.root,
|
||||
stdio: ['ignore', 1, 2],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue