From dbe54e76d828e22743777bed6f9e401af8812e60 Mon Sep 17 00:00:00 2001 From: Cleve Stuart Date: Fri, 13 Dec 2024 11:10:41 -0500 Subject: [PATCH] Test fixes? --- test/lib/formatting/colorize.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/lib/formatting/colorize.mjs b/test/lib/formatting/colorize.mjs index c826f165..1bafbb5d 100644 --- a/test/lib/formatting/colorize.mjs +++ b/test/lib/formatting/colorize.mjs @@ -4,6 +4,9 @@ import { run } from "../../../src/cli.mjs"; import { setupRealContainer } from "../../../src/config/setup-container.mjs"; import { colorize, Format } from "../../../src/lib/formatting/colorize.mjs"; +/* eslint-disable-next-line no-control-regex */ +const ansiRegex = /\u001b\[\d{1,2}(;\d{1,2})*m/g; + describe("colorize", () => { [ { format: Format.LOG, input: "Taco 8443 'Bell'", expected: "succeed" }, @@ -31,9 +34,9 @@ describe("colorize", () => { expect(fail).to.equal(expected === "fail"); if (!fail) { if (format !== Format.TEXT) { - expect(result).to.not.equal(input); + expect(ansiRegex.test(result)).to.be.true; } else { - expect(result).to.equal(input); + expect(ansiRegex.test(result)).to.be.false; } } });