Skip to content

feat(fancy): support compact option and expose built-in reporters - #452

Open
jianyunyi wants to merge 1 commit into
unjs:mainfrom
jianyunyi:main
Open

jianyunyi wants to merge 1 commit into
unjs:mainfrom
jianyunyi:main

Conversation

@jianyunyi

@jianyunyi jianyunyi commented Sep 20, 2026 •

Copy link
Copy Markdown

Description

Summary by CodeRabbit

  • Enhancements
    • Compact badge-formatted logs now display as a single line without surrounding blank lines.
    • Non-compact badge-formatted logs retain their existing spacing.

return isBadge && !opts.compact ? "\n" + line + "\n" : line;
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 04db26b3-47bb-491e-b8ff-6eac421cc1eb

📥 Commits

Reviewing files that changed from the base of the PR and between c47faac and a25870d.

📒 Files selected for processing (1)
  • src/reporters/fancy.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

FancyReporter.formatLogObj now omits surrounding newlines for badge output when compact is truthy. Non-compact badge output keeps its existing newline wrapping.

Changes

Compact badge formatting

Layer / File(s) Summary
Conditional badge line wrapping
src/reporters/fancy.ts
formatLogObj returns a single badge line when opts.compact is enabled. It preserves leading and trailing newlines otherwise.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Feature · Severity of issue fixed: Low

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #451 requires configurable newline wrapping and an exposed FancyReporter. src/reporters/fancy.ts uses !opts.compact to suppress the surrounding newlines, and FormatOptions defines `compa… Export FancyReporter from the supported public API, or add a documented package export for it. Add automated coverage for compact and non-compact badge formatting and for the public import path.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies both primary changes: support for the compact option and exposure of built-in reporters.
Out of Scope Changes check ✅ Passed The reviewed change is limited to FancyReporter badge newline formatting. This change directly supports issue #451. No unrelated behavior or unrelated files are evidenced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

Issue #451 requires configurable newline wrapping and an exposed FancyReporter. src/reporters/fancy.ts uses !opts.compact to suppress the surrounding newlines, and FormatOptions defines compact, so the wrapping requirement is implemented. However, src/index.ts imports FancyReporter but does not export it. package.json also defines no public reporter subpath. Consumers therefore cannot import FancyReporter through the package API for subclassing. The available summary also shows no automated test change for this behavior.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

FancyReporter should allow configuration of newline wrapping

1 participant