-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Change console.assert
summary to match API summary
#30725
Conversation
- Like `console.log(errorObj)`, `console.assert(condition, errorObj)` prints a stack trace. But `console log`'s summary doesn't mention this detail, nor does the API for `console.assert`. Therefore, it felt more consistent to remove it here.
Preview URLs (comment last updated: 2024-02-27 03:29:42) |
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.
The stack (in browsers) is printed by assert
itself. However in Node console.assert
doesn't print the stack.
Thank you for pointing that out. To clarify, you are referring to when an |
Did you do that in a Firefox devtool console? I tried the same code and it didn't print a stack trace: Do I have a typo?
Before my reply I open this local file and it had similar output:
I am using the latest version of Firefox. |
Ah yes, mine was Chrome... I guess it's not consistent across browsers either 😄 |
Interesting... Would that go as a note in the compatibility table? |
I don't know for sure. The console spec is messy and nothing is known for certain. I'll let others decide. |
FWIW I think we should accept this PR whether or not we decide to update the BCD.
I know, console support is super-messy, but if we ever did want to address cross-platform divergences (rather than saying as we currently do that "The specifics of how it works vary from browser to browser or server runtimes, but there is a de facto set of features that are typically provided.") then that would be a separate thing from this PR. |
I'm just adding a +1 to what Will says, this LGTM for now and clearing up implementation docs is a bigger task. I'm not sure if BCD is the right place for it (maybe it is) but it would be nice to have a programmatic way to test and display this. |
@Josh-Cena , are you OK to merge this, based on #30725 (comment)? |
Yes, I have no opinions either way. |
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.
Thanks, all - going ahead and merging 👍🏻
Description
Like
console.log(errorObj)
,console.assert(condition, errorObj)
prints a stack trace. Butconsole log
's summary doesn't mention this detail, nor does the API forconsole.assert
. Therefore, it felt more consistent to remove it here.Motivation
See above
Additional details
Modified page: https://developer.mozilla.org/en-US/docs/Web/API/console#instance_methods
console.assert page: https://developer.mozilla.org/en-US/docs/Web/API/console/assert_static
console.log page: https://developer.mozilla.org/en-US/docs/Web/API/console/log_static
Related issues and pull requests