mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Backports the following commits to 6.6: - Fix plugin-helpers test:server task (#31034)
This commit is contained in:
parent
5fd9aa225d
commit
6dcb8043e5
2 changed files with 18 additions and 19 deletions
|
@ -14,6 +14,7 @@
|
|||
"del": "^2.2.2",
|
||||
"execa": "^1.0.0",
|
||||
"gulp-rename": "1.2.2",
|
||||
"globby": "^8.0.1",
|
||||
"gulp-zip": "^4.1.0",
|
||||
"inquirer": "^1.2.2",
|
||||
"minimatch": "^3.0.4",
|
||||
|
|
|
@ -17,32 +17,30 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const resolve = require('path').resolve;
|
||||
const delimiter = require('path').delimiter;
|
||||
const execFileSync = require('child_process').execFileSync;
|
||||
const winCmd = require('../../../lib/win_cmd');
|
||||
const globby = require('globby');
|
||||
|
||||
module.exports = function (plugin, run, options) {
|
||||
options = options || {};
|
||||
const kibanaBins = resolve(plugin.kibanaRoot, 'node_modules/.bin');
|
||||
const mochaSetupJs = resolve(plugin.kibanaRoot, 'test/mocha_setup.js');
|
||||
let testPaths = plugin.serverTestPatterns;
|
||||
let testPatterns = plugin.serverTestPatterns;
|
||||
|
||||
// allow server test files to be overridden
|
||||
if (options.files && options.files.length) {
|
||||
testPaths = options.files;
|
||||
testPatterns = options.files;
|
||||
}
|
||||
|
||||
const fullCmd = resolve(plugin.kibanaRoot, 'node_modules', '.bin', 'mocha');
|
||||
const cmd = winCmd(fullCmd);
|
||||
const args = ['--require', mochaSetupJs].concat(testPaths);
|
||||
const path = `${kibanaBins}${delimiter}${process.env.PATH}`;
|
||||
|
||||
execFileSync(cmd, args, {
|
||||
cwd: plugin.root,
|
||||
stdio: ['ignore', 1, 2],
|
||||
env: Object.assign({}, process.env, {
|
||||
PATH: path
|
||||
})
|
||||
});
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
[
|
||||
'scripts/mocha',
|
||||
...globby.sync(testPatterns, {
|
||||
cwd: plugin.root,
|
||||
absolute: true,
|
||||
}),
|
||||
],
|
||||
{
|
||||
cwd: plugin.kibanaRoot,
|
||||
stdio: ['ignore', 1, 2],
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue