How to use the @tracerbench/core.getBrowserArgs function in @tracerbench/core

To help you get started, we’ve selected a few @tracerbench/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TracerBench / tracerbench / packages / cli / src / commands / record-har.ts View on Github external
const { url, dest, cookiespath, filename, marker } = flags;
    const { network, cpuThrottleRate, browserArgs } = this.parsedConfig;
    const conditions: IConditions = {
      network: network ? network : 'none',
      cpu: cpuThrottleRate ? parseInt(cpuThrottleRate as string, 10) : 1,
    };
    // grab the auth cookies
    const cookies = await readJson(resolve(cookiespath));

    // record the actual HAR and return the archive file
    const harArchive = await recordHARClient(
      url,
      cookies,
      marker,
      conditions,
      getBrowserArgs(browserArgs)
    );

    const harPath = join(dest, `${filename}.har`);

    writeFileSync(harPath, JSON.stringify(harArchive));

    this.log(`HAR recorded and available here: ${harPath}`);
  }
}