consola icon indicating copy to clipboard operation
consola copied to clipboard

feat: add support for `consola.group` & `consola.groupEnd`

Open kricsleo opened this issue 9 months ago • 6 comments

resolves #184

Preview: image

kricsleo avatar Mar 25 '25 15:03 kricsleo

Codecov Report

Attention: Patch coverage is 30.61224% with 34 lines in your changes missing coverage. Please review.

Project coverage is 29.11%. Comparing base (24c98ce) to head (d536a3e). Report is 57 commits behind head on main.

Files with missing lines Patch % Lines
examples/group.ts 0.00% 15 Missing and 1 partial :warning:
src/reporters/basic.ts 7.14% 13 Missing :warning:
src/consola.ts 50.00% 4 Missing :warning:
src/reporters/fancy.ts 66.66% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #374       +/-   ##
===========================================
- Coverage   61.08%   29.11%   -31.98%     
===========================================
  Files          13       44       +31     
  Lines        1380     1769      +389     
  Branches       58       92       +34     
===========================================
- Hits          843      515      -328     
- Misses        537     1226      +689     
- Partials        0       28       +28     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Mar 25 '25 15:03 codecov[bot]

I plan to use indentation to display groups, consistent with native behavior. What do you think? 🤔

consola.info('0 - Hello World!')

consola.group('0 - Group')
consola.info('1 - Hello World!')
consola.warn('1 - Hello World!')
consola.error(new Error('1 - Hello World!'))

consola.group('1 - Group')
consola.info('1-1 - Hello World!')
consola.warn('1-1 - Hello World!')
consola.error(new Error('1-1 - Hello World!'))
consola.groupEnd()

consola.info('1 - Hello World!')
consola.warn('1 - Hello World!')
consola.error(new Error('1 - Hello World!'))

consola.groupEnd()

consola.info('0 - Hello World!')

Would this work for you? (vertical line added) @pi0

image

kricsleo avatar Mar 26 '25 11:03 kricsleo

Surely we can also use them for indentation (array.length), I am thinking to allow show a vertical line | in left to make it more organized better than what Node.js console does wdyt?

pi0 avatar Mar 26 '25 12:03 pi0

Any news on this? Would love this feature! @kricsleo are you still working on this one? Thanks for your effort!

gkTim avatar Oct 05 '25 05:10 gkTim

I currently leave this PR as it is until more changes are requested. (And, the author, pi0 might not have enough bandwith for this for now)

kricsleo avatar Oct 10 '25 14:10 kricsleo

It is a VERY nice addition and my todo.

pi0 avatar Oct 10 '25 14:10 pi0