Skip to content

feat(internal): improve format support in node and bun #6630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

easrng
Copy link

@easrng easrng commented Apr 29, 2025

Adds support for formatting objects in recent node and bun versions using util.inspect without compromising the experience for users of other runtimes

@easrng easrng requested a review from kt3k as a code owner April 29, 2025 01:12
@CLAassistant
Copy link

CLAassistant commented Apr 29, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.73%. Comparing base (096f0be) to head (aa39536).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
internal/format.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6630      +/-   ##
==========================================
- Coverage   94.74%   94.73%   -0.01%     
==========================================
  Files         583      583              
  Lines       46478    46488      +10     
  Branches     6523     6525       +2     
==========================================
+ Hits        44036    44042       +6     
- Misses       2399     2402       +3     
- Partials       43       44       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@easrng easrng force-pushed the node-bun-format branch 4 times, most recently from 2b5b348 to 59c70c3 Compare April 29, 2025 01:53
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. This looks nice and aligned with our recent direction (towards more node compatibility).

Left some comments about test structure.

assertEquals(
stripAnsiCode(format({ a: 1, b: 2 })),
`{
if (typeof Deno.inspect === "function") {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use ignore option of Deno.test instead of big if block to exclude some tests in some environment? ref https://docs.deno.com/api/deno/~/Deno.TestDefinition

@@ -73,7 +73,10 @@ import "../../fs/unstable_lstat_test.ts";
import "../../fs/unstable_chmod_test.ts";
import "../../fs/unstable_umask_test.ts";
import "../../fs/unstable_utime_test.ts";
import "../../internal/format_test.ts";
Copy link
Member

Choose a reason for hiding this comment

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

👍

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

Successfully merging this pull request may close these issues.

3 participants