Skip to content

Conversation

@ryuapp
Copy link
Contributor

@ryuapp ryuapp commented Nov 25, 2025

It looks more natural if you respect the indentation of console.group.
console.dir on Node.js also respects group indentation, so this improves Node.js compat.

Test code:

console.dir("1");
console.group();
console.dir("2");
console.group();
console.dir("3");
console.groupEnd();
console.dir("4");
console.groupEnd();
console.dir("5");

current output:

1
2
3
4
5

this pr output:

1
  2
    3
  4
5

@coderabbitai
Copy link

coderabbitai bot commented Nov 25, 2025

Walkthrough

The change fixes Console.dir to respect the current indentation level when output within nested console.group contexts. An indentLevel property from the Console instance is passed to the formatting options for the directory argument. A new unit test validates that console.dir inside nested groups produces correctly indented output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • ext/web/01_console.js: Single line addition to pass through an existing indentation level property
  • tests/unit/console_test.ts: New test case following the established pattern of existing console tests; straightforward assertion logic
  • Changes are homogeneous and follow the existing code patterns with minimal logic density

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: making console.dir respect indent level from console.group.
Description check ✅ Passed The description clearly explains the purpose, provides a concrete test case, and shows the before/after output demonstrating the fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0bd52c4 and ce2c519.

📒 Files selected for processing (2)
  • ext/web/01_console.js (1 hunks)
  • tests/unit/console_test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js}: For JavaScript runtime debugging, enable V8 inspector with --inspect-brk flag and connect Chrome DevTools to chrome://inspect
Use console.log() for debug prints in JavaScript runtime code

Files:

  • tests/unit/console_test.ts
  • ext/web/01_console.js
🧬 Code graph analysis (1)
tests/unit/console_test.ts (1)
ext/web/01_console.js (2)
  • out (1558-1558)
  • out (2274-2274)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build libs
  • GitHub Check: lint debug linux-x86_64
  • GitHub Check: lint debug windows-x86_64
  • GitHub Check: lint debug macos-x86_64
🔇 Additional comments (2)
ext/web/01_console.js (1)

3171-3180: LGTM - Aligns console.dir with other console methods.

The change correctly passes indentLevel to respect group indentation, matching the pattern already used by log, debug, info, warn, and error methods (lines 3145, 3155, 3165, 3188, 3198).

tests/unit/console_test.ts (1)

1526-1550: LGTM - Test correctly validates indentation behavior.

The test parallels the existing consoleGroup test and properly validates that console.dir respects nested group indentation.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Cool, thanks

@bartlomieju bartlomieju merged commit efa4da8 into denoland:main Nov 28, 2025
20 checks passed
@ryuapp ryuapp deleted the fix/console-dir-respect-indent-level branch November 29, 2025 03:37
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.

2 participants