From 1d94183790f2a31ae5ba756bb6c9c1ec0103c11e Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Tue, 10 Dec 2024 00:20:17 +0100 Subject: [PATCH] chore: replace chalk with picocolors Replaces chalk and its dependencies, 94 KB of unpacked size in total, with picocolors, doing the same thing, but under 1 KB. --- package.json | 2 +- src/to-have-style.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a9ddf16..e7946cd 100644 --- a/package.json +++ b/package.json @@ -82,10 +82,10 @@ "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", - "chalk": "^3.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "lodash": "^4.17.21", + "picocolors": "^1.1.1", "redent": "^3.0.0" }, "devDependencies": { diff --git a/src/to-have-style.js b/src/to-have-style.js index 010e2a5..bf292d8 100644 --- a/src/to-have-style.js +++ b/src/to-have-style.js @@ -1,4 +1,4 @@ -import chalk from 'chalk' +import picocolors from 'picocolors' import {checkHtmlElement, parseCSS} from './utils' function getStyleDeclaration(document, css) { @@ -50,7 +50,7 @@ function expectedDiff(diffFn, expected, computedStyles) { ) const diffOutput = diffFn(printoutStyles(expected), printoutStyles(received)) // Remove the "+ Received" annotation because this is a one-way diff - return diffOutput.replace(`${chalk.red('+ Received')}\n`, '') + return diffOutput.replace(`${picocolors.red('+ Received')}\n`, '') } export function toHaveStyle(htmlElement, css) {