UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

39 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AnsiDiffFormatter = void 0; const chalk_1 = require("chalk"); // eslint-disable-line unicorn/import-style /** * A [`DiffFormatter`](https://serenity-js.org/api/core/interface/DiffFormatter/) that uses [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) * to format the output. * * @group Errors */ class AnsiDiffFormatter { chalk; /** * Instantiates an `AnsiDiffFormatter`, configured with colour support options for [Chalk](https://github.com/chalk/chalk). * When no `chalkOptions` object is provided, Chalk will auto-detect colour support automatically based on the execution environment. * * Available colour support levels: * - `0` - All colours disabled. * - `1` - Basic 16 colours support. * - `2` - ANSI 256 colours support. * - `3` - Truecolor - 16 million colours support. * * @param chalkOptions */ constructor(chalkOptions) { this.chalk = new chalk_1.Instance(chalkOptions); } expected(line) { return this.chalk.green(line); } received(line) { return this.chalk.red(line); } unchanged(line) { return line; } } exports.AnsiDiffFormatter = AnsiDiffFormatter; //# sourceMappingURL=AnsiDiffFormatter.js.map