| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Completed. Request review from @nodejs/url A few tests are out of sync/not sync'ed:
The test data is out of sync too, I've updated setters_tests.json to the latest compatible version, later versions of setters_tests.json and urltestdata.json already have their tracking issues. There are some tests commented out because we are not compatible yet, the major blocker is #10454 (PR: #10967) and the encoding of space to + in search params. The major blocker of test data jsons is #10655 |
Sorry, something went wrong.
|
Force pushed because of filename mistakes. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with a couple nits
Sorry, something went wrong.
There was a problem hiding this comment.
Perhaps remove the commented out code sections?
Sorry, something went wrong.
There was a problem hiding this comment.
I think just commenting them out would make it easier to update and easier to compare with the upstream, maybe just me though
Sorry, something went wrong.
There was a problem hiding this comment.
nit: template string may be better here
Sorry, something went wrong.
There was a problem hiding this comment.
Just copy-pasting the upstream. I think they don't do ES.Next features for browser compatibility?
Sorry, something went wrong.
There was a problem hiding this comment.
Ok, that's fine then
Sorry, something went wrong.
There was a problem hiding this comment.
Can we upstream these to web-platform-tests? I can do it if that'd be easier.
Sorry, something went wrong.
There was a problem hiding this comment.
I can give it a try first :D. These test cases don't have base so is urltestdata.json the right place to go?
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah. No base is just a base of about:blank, so just add that.
Sorry, something went wrong.
There was a problem hiding this comment.
Cool, thanks!
Sorry, something went wrong.
There was a problem hiding this comment.
Why is this commented out?
Sorry, something went wrong.
There was a problem hiding this comment.
"??a=b&c=d" is broken at the moment, can make another PR to skip specific test cases later I think (though the whole condition doesn't have to be commented out. I'll change that)
Sorry, something went wrong.
There was a problem hiding this comment.
Nice work!
Sorry, something went wrong.
There was a problem hiding this comment.
I'd rather have a more featureful test(), perhaps one like
(fn, desc) => {
try {
fn();
} catch (err) {
if (err instanceof Error)
err.message = `In ${desc}:\n ${err.message}`;
throw err;
}
}
Sorry, something went wrong.
There was a problem hiding this comment.
Done! Thanks
Sorry, something went wrong.
|
Rebased and updated URL search parameters constructor tests to w3c/web-platform-tests/405394a now that #11060 has been merged. EDIT: oops, I mean 405394a for search params tests |
Sorry, something went wrong.
There was a problem hiding this comment.
There is also the issue of attribution. According to the W3C 3-clause BSD License (the alternative does not allow modification of source), we "must retain the original copyright notice". I don't think we are doing that currently.
Sorry, something went wrong.
There was a problem hiding this comment.
You can condense these three lines into
const { URL, URLSearchParams } = require('url');
Sorry, something went wrong.
There was a problem hiding this comment.
The signature of assert_unreached() in WPT is (description), but assert.fail() in Node.js is (actual, expected, message, operator). Maybe
(description) => assert.fail('reached', 'unreached', `Reached unreachable code: ${description}`, 'is')?
Sorry, something went wrong.
There was a problem hiding this comment.
According to the docs
If message is falsy, the error message is set as the values of actual and expected separated by the provided operator. Otherwise, the error message is the value of message.
Probably just
assert.fail(undefined, undefined, `Reached unreachable code: ${description}`);
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung, yeah, that'd work as well. IMO the 2 undefineds look a bit too long to be aesthetically pleasing, but up to you.
Sorry, something went wrong.
|
@TimothyGu Thanks for catching the copyright notice, looks like url-tests.json is doing that with License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html So I'll put this in other files too. @jasnell is it the right way to do it? |
Sorry, something went wrong.
|
Yes, our JSON parsing does not recognize regular javascript style comments so including it in a property like this is good. |
Sorry, something went wrong.
|
New CI: https://ci.nodejs.org/job/node-test-pull-request/6165/ @TimothyGu Does this LGTY? |
Sorry, something went wrong.
|
Aborted CI, only arm-fanned was pending because of nodejs/build#611 |
Sorry, something went wrong.
Sorry, something went wrong.
* attributon of WPT in url-setter-tests * add WPT test utilities * synchronize WPT URLSearchParams tests * synchronize WPT url tests * split whatwg-url-inspect test * port historical url tests from WPT * protocol setter and special URLs Refs: web-platform-tests/wpt#4413 Refs: whatwg/url#104 PR-URL: #11079 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
* attributon of WPT in url-setter-tests * add WPT test utilities * synchronize WPT URLSearchParams tests * synchronize WPT url tests * split whatwg-url-inspect test * port historical url tests from WPT * protocol setter and special URLs Refs: web-platform-tests/wpt#4413 Refs: whatwg/url#104 Backport-of: nodejs#11079
* attributon of WPT in url-setter-tests * add WPT test utilities * synchronize WPT URLSearchParams tests * synchronize WPT url tests * split whatwg-url-inspect test * port historical url tests from WPT * protocol setter and special URLs Refs: web-platform-tests/wpt#4413 Refs: whatwg/url#104 Backport-of: nodejs#11079
* attributon of WPT in url-setter-tests * add WPT test utilities * synchronize WPT URLSearchParams tests * synchronize WPT url tests * split whatwg-url-inspect test * port historical url tests from WPT * protocol setter and special URLs Refs: web-platform-tests/wpt#4413 Refs: whatwg/url#104 Backport-of: #11079
* attributon of WPT in url-setter-tests * add WPT test utilities * synchronize WPT URLSearchParams tests * synchronize WPT url tests * split whatwg-url-inspect test * port historical url tests from WPT * protocol setter and special URLs Refs: web-platform-tests/wpt#4413 Refs: whatwg/url#104 PR-URL: nodejs#11079 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
| Back | FazBrowse Home | New Git URL |
This is still a WIP, I'll update all the URLSearchParams tests first, then see how we can synchronize other tests. But I would like to get some feedback from @nodejs/url just to make sure I'm on the right direction.
This is an attempt to synchronize the tests of our WHATWG URL implementation with the tests in https://github.com/w3c/web-platform-tests/tree/master/url. #9484 ported some of the URLSearchParams tests into our code base, but it is somewhat hard to see how up-to-date we are compared with the upstream tests.
In this PR, the upstream tests are placed like this
Checklist
Affected core subsystem(s)
test, url-whatwg