-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
console: make console consistent with the standard - overridable #12454
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
Changes from 1 commit
ea237b2
d98c130
4a0669d
fad6725
6e86bca
79dc629
e10a6dd
28c32a2
02768c0
5f9d30f
bb26718
352d504
197ec07
c653812
5a411bc
c9c572a
b553b49
b7d9771
8023728
490374f
2f43d8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Update the test from the most recent WPT contents. Copyedit some existing comments.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,49 @@ | ||
| 'use strict'; | ||
|
|
||
| // https://heycam.github.io/webidl/#es-namespaces | ||
| // https://console.spec.whatwg.org/#console-namespace | ||
| // https://github.com/w3c/web-platform-tests/blob/40e451c/console/console-is-a-namespace.any.js | ||
| require('../common'); | ||
|
|
||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const { test, assert_equals, assert_true, assert_false } = common.WPT; | ||
| const { test, assert_equals, assert_true, assert_false } = | ||
| require('../common/wpt'); | ||
|
|
||
| assert.doesNotThrow(() => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with L23. We can get rid of this test from this file.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @watilde
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean exclude a duplicate?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh you're right! It's better to keep the test case to verify the update, and we don't need to move it into a separate file since this test is related to namespace :) |
||
| global.console = global.console; | ||
| }); | ||
|
|
||
| // Tests above are not from WPT. | ||
| // Tests below are from WPT. | ||
| const self = global; | ||
|
|
||
| /* eslint-disable */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If Node collaborators should not modify these tests in any way, please add a comment here stating that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjihrig like that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put the comment inside the existing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjihrig done.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjihrig do you want any other improvement?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjihrig are you going approve my PR? Do you have any objection? Do you make all newcomers feel unwelcome here or it's personal?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Wandalen ... this kind of comment is unwarranted. We are all busy and this repository has a high level of activity that is often difficult to keep track of. Many of us receive hundreds of notifications per day. Patience would be appreciated.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jasnell could you please tell what would be an appropriate comment there? I caught another issue with ArrayBuffer. Looking forward to starting work on that issue once you will approve the PR. At the point, I clearly see that the majority of the community is friendly, but the minority make me feel unwelcome here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Wandalen try not to get frustrated, and really don't take it personally.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @refack thank you for kind words. |
||
| /* The following tests are copied from */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd still prefer if this said not to modify, not just that it's copied. |
||
| /* WPT Refs: | ||
| https://github.com/w3c/web-platform-tests/blob/40e451c/console/console-is-a-namespace.any.js | ||
| License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html | ||
| */ | ||
| /* Do not modify. */ | ||
|
|
||
| test(() => { | ||
| assert_true(global.hasOwnProperty('console')); | ||
| }, 'console exists on the global object'); | ||
| // https://heycam.github.io/webidl/#es-namespaces | ||
| // https://console.spec.whatwg.org/#console-namespace | ||
|
|
||
| test(() => { | ||
| assert_true(global.hasOwnProperty('console')); | ||
| }, 'console exists on the global object'); | ||
| assert_true(self.hasOwnProperty("console")); | ||
| }, "console exists on the global object"); | ||
|
|
||
| test(() => { | ||
| const propDesc = Object.getOwnPropertyDescriptor(global, 'console'); | ||
| assert_equals(propDesc.writable, true, 'must be writable'); | ||
| assert_equals(propDesc.enumerable, false, 'must not be enumerable'); | ||
| assert_equals(propDesc.configurable, true, 'must be configurable'); | ||
| assert_equals(propDesc.value, console, 'must have the right value'); | ||
| }, 'console has the right property descriptors'); | ||
| const propDesc = Object.getOwnPropertyDescriptor(self, "console"); | ||
| assert_equals(propDesc.writable, true, "must be writable"); | ||
| assert_equals(propDesc.enumerable, false, "must not be enumerable"); | ||
| assert_equals(propDesc.configurable, true, "must be configurable"); | ||
| assert_equals(propDesc.value, console, "must have the right value"); | ||
| }, "console has the right property descriptors"); | ||
|
|
||
| test(() => { | ||
| assert_false('Console' in global); | ||
| }, 'Console (uppercase, as if it were an interface) must not exist'); | ||
| assert_false("Console" in self); | ||
| }, "Console (uppercase, as if it were an interface) must not exist"); | ||
|
|
||
| test(() => { | ||
| const prototype1 = Object.getPrototypeOf(console); | ||
| const prototype2 = Object.getPrototypeOf(prototype1); | ||
| // assert_equals(Object.getOwnPropertyNames(prototype1).length, 0, | ||
| // 'The [[Prototype]] must have no properties'); | ||
| assert_equals(prototype2, Object.prototype, | ||
| 'The [[Prototype]]\'s [[Prototype]] must be Object Prototype'); | ||
|
|
||
| }, 'The prototype chain must be correct'); | ||
| // test(() => { | ||
| // const prototype1 = Object.getPrototypeOf(console); | ||
| // const prototype2 = Object.getPrototypeOf(prototype1); | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And please use the standard footer here, since the test below is not part of WPT.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added /* eslint-enable */ |
||
| // assert_equals(Object.getOwnPropertyNames(prototype1).length, 0, "The [[Prototype]] must have no properties"); | ||
| // assert_equals(prototype2, Object.prototype, "The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%"); | ||
| // }, "The prototype chain must be correct"); | ||
| /* eslint-enable */ | ||
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.
Can you use the standard header for WPT tests?
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.
Hi TinothyGu. Do you mean remove assert_false from the list?
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.
Sorry for the confusion. I was referring to the "WPT Refs" block in the file I linked. Specifically, a permalink to the source of the file as well as a URL pointing to the license under which the WPT test is used should be included for compliance.
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 for explanation. Added.