Add inspect flag to api test script for debugging (#128275)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Giorgos Bamparopoulos 2022-03-28 11:27:40 +01:00 committed by GitHub
parent 126b140662
commit 3704642366
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,9 +39,22 @@ const { argv } = yargs(process.argv.slice(2))
type: 'string',
description: 'Specify the spec files to run',
})
.option('inspect', {
default: false,
type: 'boolean',
description: 'Add --inspect-brk flag to the ftr for debugging',
})
.check((argv) => {
const { inspect, runner } = argv;
if (inspect && !runner) {
throw new Error('--inspect can only be used with --runner');
} else {
return true;
}
})
.help();
const { trial, server, runner, grep } = argv;
const { trial, server, runner, grep, inspect } = argv;
const license = trial ? 'trial' : 'basic';
console.log(`License: ${license}`);
@ -53,8 +66,9 @@ if (server) {
ftrScript = 'functional_test_runner';
}
const inspectArg = inspect ? '--inspect-brk' : '';
const grepArg = grep ? `--grep "${grep}"` : '';
const cmd = `node ../../../../scripts/${ftrScript} ${grepArg} --config ../../../../test/apm_api_integration/${license}/config.ts`;
const cmd = `node ${inspectArg} ../../../../scripts/${ftrScript} ${grepArg} --config ../../../../test/apm_api_integration/${license}/config.ts`;
console.log(`Running ${cmd}`);