-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(browser): string formatting bug when including placeholders in console.log (fix #9030) #9131
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
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
hi-ogawa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/browser/fixtures/print-logs/test/logs.test.ts is failing. Can you also add new test there?
|
Hello @hi-ogawa, I noticed that some tests require new lines when printing objects to the console, while others do not. Is this expected behavior? Currently, printing objects yields different results in the browser versus Node. Browser objects have new lines, but Node objects do not. Shouldn't the output be consistent across environments?
If this discrepancy is normal, I can write a custom format function for the browser (or add an option to the existing one) to support new lines without breaking the core tests. I am new to this repo, so any guidance is appreciated. |
Why wouldn't it be normal? Browser prints objects and HTML elements differently. We don't want to see a huge object instead of an HTML. We use |
|
yeah you're right, thanks for your response @sheremet-va |
hi-ogawa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I tweaked some code to reduce the diff.

Description
This PR fixes a bug where placeholders failed to render in the terminal. Previously, processLog handled arguments individually before calling format. This change removes the .map call and passes the arguments directly to the format function.
Resolves #9030
Before the fix:

After the fix:

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.