How to use the lighthouse-logger.cross function in lighthouse-logger

To help you get started, we’ve selected a few lighthouse-logger 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 GoogleChrome / lighthouse-ci / packages / cli / src / assert / assert.js View on Github external
let hasFailure = false;
  for (const results of groupedResults) {
    const url = results[0].url;
    const sortedResults = results.sort((a, b) => {
      const {level: levelA = 'error', auditId: auditIdA = 'unknown'} = a;
      const {level: levelB = 'error', auditId: auditIdB = 'unknown'} = b;
      return levelA.localeCompare(levelB) || auditIdA.localeCompare(auditIdB);
    });

    process.stderr.write(`${sortedResults.length} result(s) for ${log.bold}${url}${log.reset}\n`);

    for (const result of sortedResults) {
      hasFailure = hasFailure || result.level === 'error';
      const label = result.level === 'warn' ? 'warning' : 'failure';
      const icon = result.level === 'warn' ? '⚠️ ' : `${log.redify(log.cross)} `;
      const idPart = `${log.bold}${result.auditId}${log.reset}`;
      const propertyPart = result.auditProperty ? `.${result.auditProperty}` : '';
      const namePart = `${log.bold}${result.name}${log.reset}`;

      const auditTitlePart = result.auditTitle || '';
      const documentationPart = result.auditDocumentationLink
        ? `Documentation: ${result.auditDocumentationLink}`
        : '';
      const titleAndDocs = [auditTitlePart, documentationPart]
        .filter(Boolean)
        .map(s => `     ` + s)
        .join('\n');
      const humanFriendlyParts = titleAndDocs ? `\n${titleAndDocs}\n` : '';

      process.stderr.write(`
  ${icon} ${idPart}${propertyPart} ${label} for ${namePart} assertion${humanFriendlyParts}