-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat(ext/console): Only right-align integers in console.table() #17389
Conversation
f450014
to
6f63857
Compare
Here's a screenshot of the failing (newly added) test: I'm not sure why the "expected" part is printed like that — it is correctly aligned in the source code... Btw, this change also affects other tests that should not have been affected, e.g. |
@kt3k please review this PR |
The diff looks good to me.
I don't see the failing test cases. Have you fixed them already? |
No, I didn't make changes to this branch since my last comment. Maybe something else changed in the codebase. I'll rebase the branch and try again. |
6f63857
to
350ae92
Compare
350ae92
to
98d5b35
Compare
I've rebased the branch but I still get a test failure. The situation did improve: I now only get a failure in the specific test I added, rather than also in unrelated ones; and the printing of the results in the console now looks OK: ...although it still fails, for some reason. It's as if the For the record, I'm using |
Looks like CI is skipping the tests because the PR is marked as draft. I'll mark it as ready for review so that hopefully the same issue can be reproduced in CI. |
98d5b35
to
ba3d582
Compare
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.
LGTM
This PR changes
console.table()
to only right-align columns when their contents are integers (rather than any numbers, as is currently the case). This was proposed in this comment on #11294. A new test is added to validate this behavior.The goal is to change from this:
to this:
(Of course, the ideal would be to align numbers regardless of how many decimal places they have, i.e.:
...but I don't know how to go about doing that 😅)
Follow-up of #11295 and #11748.
I also tweaked formatting of
console.table()
tests (in a separate commit), to make the table format more evident in the source code of the tests.Note: I'm opening as draft because I can't get the tests to pass — something in the logic to detect whether an entire column consists only of integers seems to be failing, but I'm not sure what. Any assistance would greatly appreciated!