Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main(pg) {
debug(pg);
const { parallel, path: caseDir, ...options } = prepare(pg);
if (cluster.isMaster) {
const files = ((await readdir(
path.resolve(process.cwd(), caseDir)
)) as string[])
.sort()
.filter(f => {
return f.endsWith("yaml") || f.endsWith("yml");
});
if (!parallel) {
// single thread
for (const f of files) {
await pprun({ file: f, options });
}
return;
}
// multi thread
const pNum = Math.max(numCPUs, parallel);
for (let i = 0; i < pNum; i++) {