Skip to content

Conversation

JoshuaKGoldberg
Copy link
Member

PR Checklist

Overview

Per the issue, switches from ansi-colors to the smaller picocolors for colorization. It seems to be a drop-in replacement.

@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team April 7, 2025 17:41
@mark-wiemer mark-wiemer self-requested a review April 9, 2025 15:38
@JoshuaKGoldberg JoshuaKGoldberg merged commit 7c08d09 into mochajs:main Apr 10, 2025
75 checks passed
@voxpelli voxpelli requested a review from Copilot June 12, 2025 07:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the ansi-colors dependency with picocolors across the CLI to reduce package size and maintain a drop-in API compatibility.

  • Removed ansi-colors and added picocolors in package.json
  • Updated all CLI modules to require('picocolors') and swapped ansi.* calls for pc.*

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Removed ansi-colors and added picocolors dependency
lib/cli/run.js Swapped ansi.redpc.red for error output
lib/cli/run-helpers.js Swapped ansi.yellowpc.yellow for warnings
lib/cli/options.js Swapped ansi.redpc.red for parse errors
lib/cli/collect-files.js Swapped ansi.red/ansi.yellowpc.red/pc.yellow
lib/cli/cli.js Swapped multiple ansi.* calls in error handlers and epilog
Comments suppressed due to low confidence (3)

lib/cli/run.js:11

  • [nitpick] The alias pc is short and may be unclear to future readers; consider renaming it to colors or picocolors for better readability.
const pc = require('picocolors');

lib/cli/collect-files.js:5

  • [nitpick] Consistent naming across files improves maintainability; consider using a clearer alias like colors instead of pc.
const pc = require('picocolors');

lib/cli/run.js:360

  • There are no existing tests validating CLI error output formatting; consider adding a test to assert that error messages are correctly colored with picocolors.
console.error(`\n${symbols.error} ${pc.red('ERROR:')}`, err);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: Replace ansi-colors with a faster, smaller alternative
2 participants