Skip to content

Commit

Permalink
test,benchmark: stop requiring URL and URLSearchParams
Browse files Browse the repository at this point in the history
Since the URL and URLSearchParams classes are available in the
global object, there is no need to require them from 'url'.

PR-URL: #36927
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
RaisinTen authored and targos committed May 1, 2021
1 parent e72b2b4 commit 98f08c0
Show file tree
Hide file tree
Showing 44 changed files with 0 additions and 45 deletions.
1 change: 0 additions & 1 deletion benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const { URLSearchParams } = require('url');
const querystring = require('querystring');
const searchParams = common.searchParams;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const { URLSearchParams } = require('url');
const querystring = require('querystring');
const searchParams = common.searchParams;

Expand Down
1 change: 0 additions & 1 deletion benchmark/url/url-searchparams-iteration.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
const assert = require('assert');
const { URLSearchParams } = require('url');

const bench = common.createBenchmark(main, {
loopMethod: ['forEach', 'iterator'],
Expand Down
1 change: 0 additions & 1 deletion benchmark/url/url-searchparams-read.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const { URLSearchParams } = require('url');

const bench = common.createBenchmark(main, {
accessMethod: ['get', 'getAll', 'has'],
Expand Down
1 change: 0 additions & 1 deletion benchmark/url/url-searchparams-sort.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const URLSearchParams = require('url').URLSearchParams;

const inputs = {
wpt: 'wpt', // To work around tests
Expand Down
1 change: 0 additions & 1 deletion test/es-module/test-esm-dynamic-import.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const { URL } = require('url');

const relativePath = '../fixtures/es-modules/test-esm-ok.mjs';
const absolutePath = require.resolve('../fixtures/es-modules/test-esm-ok.mjs');
Expand Down
1 change: 0 additions & 1 deletion test/es-module/test-esm-loader-modulemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
require('../common');

const assert = require('assert');
const { URL } = require('url');
const { Loader } = require('internal/modules/esm/loader');
const ModuleMap = require('internal/modules/esm/module_map');
const ModuleJob = require('internal/modules/esm/module_job');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-fs-exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const { URL } = require('url');
const f = __filename;

assert.throws(() => fs.exists(f), { code: 'ERR_INVALID_CALLBACK' });
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-fs-null-bytes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const URL = require('url').URL;

function check(async, sync) {
const argsSync = Array.prototype.slice.call(arguments, 2);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-fs-whatwg-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const assert = require('assert');
const path = require('path');
const fs = require('fs');
const os = require('os');
const URL = require('url').URL;

function pathToFileURL(p) {
if (!path.isAbsolute(p))
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http-client-get-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const common = require('../common');
const assert = require('assert');
const http = require('http');
const url = require('url');
const URL = url.URL;
const testPath = '/foo?bar';

const server = http.createServer(common.mustCall((req, res) => {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-altsvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasCrypto)

const assert = require('assert');
const http2 = require('http2');
const { URL } = require('url');
const Countdown = require('../common/countdown');

const server = http2.createServer();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-connect-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasCrypto)
const assert = require('assert');
const net = require('net');
const http2 = require('http2');
const { URL } = require('url');

const {
HTTP2_HEADER_METHOD,
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-create-client-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if (!common.hasCrypto)
const fixtures = require('../common/fixtures');
const h2 = require('http2');
const url = require('url');
const URL = url.URL;

{
const server = h2.createServer();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http2-response-splitting.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const http2 = require('http2');
const { URL } = require('url');

// Response splitting example, credit: Amit Klein, Safebreach
const str = '/welcome?lang=bar%c4%8d%c4%8aContent­Length:%200%c4%8d%c4%8a%c' +
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-https-client-get-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const assert = require('assert');
const https = require('https');
const url = require('url');

const URL = url.URL;

const options = {
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-url-format-whatwg.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasIntl)

const assert = require('assert');
const url = require('url');
const URL = url.URL;

const myURL = new URL('http://xn--lck1c3crb1723bpq4a.com/a?a=b#c');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-vm-module-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
const common = require('../common');

const assert = require('assert');
const { URL } = require('url');

const { SourceTextModule } = require('vm');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasIntl) {
}

const fixtures = require('../common/fixtures');
const { URL, URLSearchParams } = require('url');
const { test, assert_equals, assert_true, assert_throws } =
require('../common/wpt').harness;

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const { URL, URLSearchParams } = require('url');

assert.deepStrictEqual(
Object.getOwnPropertyDescriptor(global, 'URL'),
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if (!common.hasIntl) {
}

const util = require('util');
const URL = require('url').URL;
const assert = require('assert');

const url = new URL('https://username:[email protected]:8080/path/name/?que=ry#hash');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-parsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if (!common.hasIntl) {
common.skip('missing Intl');
}

const URL = require('url').URL;
const assert = require('assert');
const fixtures = require('../common/fixtures');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Tests below are not from WPT.

require('../common');
const URL = require('url').URL;
const assert = require('assert');
const urlToOptions = require('internal/url').urlToOptions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

{
const params = new URLSearchParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

function makeIterableFunc(array) {
return Object.assign(() => {}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const { URL, URLSearchParams } = require('url');

{
const params = new URLSearchParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

// Tests below are not from WPT.
const params = new URLSearchParams('a=b&c=d');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const { URLSearchParams } = require('url');

{
const params = new URLSearchParams();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

{
const params = new URLSearchParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

{
const params = new URLSearchParams();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-has.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

{
const params = new URLSearchParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require('../common');
const assert = require('assert');
const util = require('util');
const URLSearchParams = require('url').URLSearchParams;

const sp = new URLSearchParams('?a=a&b=b&b=c');
assert.strictEqual(util.inspect(sp),
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

const params = new URLSearchParams('a=b&c=d');
const keys = params.keys();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

{
const params = new URLSearchParams();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Tests below are not from WPT.

require('../common');
const { URL, URLSearchParams } = require('url');
const { test, assert_array_equals } = require('../common/wpt').harness;

// TODO(joyeecheung): upstream this to WPT, if possible - even
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

{
const params = new URLSearchParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;

const params = new URLSearchParams('a=b&c=d');
const values = params.values();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-searchparams.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const { URL, URLSearchParams } = require('url');
const fixtures = require('../common/fixtures');

const serialized = 'a=a&a=1&a=true&a=undefined&a=null&a=%EF%BF%BD' +
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if (!common.hasIntl) {
}

const assert = require('assert');
const URL = require('url').URL;
const { test, assert_equals } = require('../common/wpt').harness;
const fixtures = require('../common/fixtures');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-custom-tostringtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;

const toString = Object.prototype.toString;

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasIntl) {
}

const fixtures = require('../common/fixtures');
const URL = require('url').URL;
const { test, assert_equals } = require('../common/wpt').harness;

const request = {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasIntl) {
common.skip('missing Intl');
}

const URL = require('url').URL;
const { test, assert_equals } = require('../common/wpt').harness;
const fixtures = require('../common/fixtures');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-whatwg-url-toascii.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (!common.hasIntl) {
}

const fixtures = require('../common/fixtures');
const { URL } = require('url');
const { test, assert_equals, assert_throws } = require('../common/wpt').harness;

const request = {
Expand Down
1 change: 0 additions & 1 deletion test/sequential/test-inspector-port-zero.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { mustCall, skipIfInspectorDisabled } = require('../common');
skipIfInspectorDisabled();

const assert = require('assert');
const { URL } = require('url');
const { spawn } = require('child_process');

function test(arg, port = '') {
Expand Down

0 comments on commit 98f08c0

Please sign in to comment.