How to use the lighthouse-logger.greenify 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
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}
        expected: ${result.operator}${log.greenify(result.expected)}
           found: ${log.redify(result.actual)}
      ${log.dim}all values: ${result.values.join(', ')}${log.reset}\n\n`);
    }
  }

  saveAssertionResults(allResults);

  if (hasFailure) {
    process.stderr.write(`Assertion failed. Exiting with status code 1.\n`);
    process.exit(1);
  }

  process.stderr.write(`All results processed!\n`);
}