Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
squash: update test-console-is-a-namespace
Update the test from the most recent WPT contents. Copyedit some
existing comments.
  • Loading branch information
Trott committed Aug 16, 2017
commit 490374fd75c01196b4c2654e904d8f0bf5535797
51 changes: 22 additions & 29 deletions test/parallel/test-console-is-a-namespace.js
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');

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for explanation. Added.

assert.doesNotThrow(() => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hello @watilde

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you mean exclude a duplicate?

Copy link
Copy Markdown
Contributor Author

@Wandalen Wandalen Apr 17, 2017

Choose a reason for hiding this comment

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

@watilde I removed the duplicate. Also there is a comment, explaining the test case above is not from WPT. The first test case is useful. It fails with original version of booststrap_node.js. Do you suggest to move the first test case into separate test suite?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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 */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cjihrig like that?

Copy link
Copy Markdown
Contributor

@cjihrig cjihrig May 1, 2017

Choose a reason for hiding this comment

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

I would put the comment inside the existing WPT Refs: block comment and say something like "The following tests are copied from upstream verbatim. Do not modify."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cjihrig done.

Copy link
Copy Markdown
Contributor Author

@Wandalen Wandalen May 1, 2017

Choose a reason for hiding this comment

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

@cjihrig do you want any other improvement?

Copy link
Copy Markdown
Contributor Author

@Wandalen Wandalen May 11, 2017

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.
Initially I also had a hard time trying to deduce people's intention and emotions from just these text messages. It's hard, I misunderstood some stuff, I took it personally, and I got frustrated, and then angry, and that leads to nowhere good.
If you found another issue to channel your energy into, I say go for it. This PR will most probably land in due time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@refack thank you for kind words.

/* The following tests are copied from */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 */