Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const handler = async (argv) => {
const config = getConfig(argv)
const username = config.user || process.env.SAUCE_USERNAME
const accessKey = config.key || process.env.SAUCE_ACCESS_KEY
const jobName = getJobName(config)
const buildName = config.build || `${jobName} - ${(new Date()).toString()}`
const budget = config ? config.budget : null
const metrics = budget ? getBudgetMetrics(budget) : getMetricParams(config)
const jankinessScore = getJankinessParam(argv, budget)
/**
* check if username and access key are available
*/
if (!username || !accessKey) {
yargs.showHelp()
// eslint-disable-next-line no-console
console.error(ERROR_MISSING_CREDENTIALS)
return process.exit(1)
}
const status = ora(`Start performance test run with user ${username} on page ${config.site}...`).start()
const logDir = config.logDir
? path.resolve(process.cwd(), config.logDir)
: tmp.dirSync().name
/**
* check if job already exists
*/
const user = new SauceLabs({
user: username,
Promise.all(allTasks)
.then(() => {
if (argv.x) {
print.success(l10n('MAIN_ALL_X_DONE'));
} else {
print.success(l10n('MAIN_ALL_DONE'));
}
db.save();
})
.catch((_) => {
// Error will print by downloaders, keep quiet
});
} else if (argv._.length > 1 || !supportCommands.includes(argv._[0])) {
// Unknown command
yargs.showHelp();
}
}
function main() {
if (args.help) {
yargs.showHelp();
} else {
runBench(runFrameworks).catch((error: Error) => { throw error; });
}
}
function throwHelpError(msg: string): never {
yargs.showHelp('error');
console.error(`\nERROR: ${msg}`);
return process.exit(1);
}
async function processArgsAsync() {
let input
try {
let inputItems = []
input = await getStdin()
if (input) {
inputItems = input.trim().split(' ')
yargs.parse(inputItems)
}
} catch (error) {
yargs.showHelp()
console.error(`Error reading from stdin: ${input}`)
}
let argv = yargs
.usage(
'Usage: ' +
require.main.filename
.split('/')
.pop()
.slice(0, -3) +
' [options] '
)
.option('s', {
alias: 'server',
requiresArg: true,
default: env.CHAINPOINT_NODE_API_BASE_URI,
function parseArguments(args) {
var argv = yargs.parse(args);
if (argv.help) {
yargs.showHelp();
process.exit(0);
return;
}
if (argv.jmk) {
var install = require('../scripts/install');
install(process.cwd());
process.exit(0);
return;
}
var options = {
stdout: argv.stdout,
verbose: argv.verbose
};
);
return process.exit(1);
}
if (
!argv.unused &&
!argv.deprecated &&
!argv.invalid &&
!argv.current &&
!argv.available
) {
printColumns(
chalk.red(`Oops, one of the command line Options must be set...${EOL}`)
);
yargs.showHelp();
return process.exit(1);
}
return cosmiconfig;
}
})
.help('h')
.alias('h', 'help')
.version(json.version)
.epilog(json.homepage)
.strict()
.argv;
const command = argv._[0];
if (command === 'corpus-stats') {
const corpusPath = path.join('yak', 'corpus.txt');
const corpus = await readFile(corpusPath);
printStats(corpus.toString().toLowerCase());
} else {
yargs.showHelp();
}
})();
export function help(): void {
yargs.showHelp("log");
}
handler(): void {
showHelp('log');
},
};