mirror of
https://github.com/denoland/deno.git
synced 2025-02-14 17:47:35 -05:00
reduce compat cases added in #27134
This commit is contained in:
parent
502a6d21ad
commit
6df2526c17
7 changed files with 6 additions and 273 deletions
|
@ -565,9 +565,7 @@
|
|||
"test-handle-wrap-close-abort.js",
|
||||
"test-http-abort-before-end.js",
|
||||
"test-http-addrequest-localaddress.js",
|
||||
"test-http-agent-false.js",
|
||||
"test-http-agent-getname.js",
|
||||
"test-http-agent-keepalive-delay.js",
|
||||
"test-http-agent-maxtotalsockets.js",
|
||||
"test-http-agent-no-protocol.js",
|
||||
"test-http-agent-null.js",
|
||||
|
@ -590,7 +588,6 @@
|
|||
"test-http-client-race.js",
|
||||
"test-http-client-read-in-error.js",
|
||||
"test-http-client-reject-unexpected-agent.js",
|
||||
"test-http-client-timeout-connect-listener.js",
|
||||
"test-http-client-timeout-with-data.js",
|
||||
"test-http-client-unescaped-path.js",
|
||||
"test-http-client-upload-buf.js",
|
||||
|
@ -604,7 +601,6 @@
|
|||
"test-http-date-header.js",
|
||||
"test-http-decoded-auth.js",
|
||||
"test-http-default-encoding.js",
|
||||
"test-http-dump-req-when-res-ends.js",
|
||||
"test-http-end-throw-socket-handling.js",
|
||||
"test-http-eof-on-connect.js",
|
||||
"test-http-extra-response.js",
|
||||
|
@ -622,7 +618,6 @@
|
|||
"test-http-hex-write.js",
|
||||
"test-http-highwatermark.js",
|
||||
"test-http-host-headers.js",
|
||||
"test-http-hostname-typechecking.js",
|
||||
"test-http-incoming-message-destroy.js",
|
||||
"test-http-invalid-path-chars.js",
|
||||
"test-http-invalidheaderfield.js",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!-- deno-fmt-ignore-file -->
|
||||
# Remaining Node Tests
|
||||
|
||||
1120 tests out of 3681 have been ported from Node 20.11.1 (30.43% ported, 69.68% remaining).
|
||||
1115 tests out of 3681 have been ported from Node 20.11.1 (30.29% ported, 69.82% remaining).
|
||||
|
||||
NOTE: This file should not be manually edited. Please edit `tests/node_compat/config.json` and run `deno task setup` in `tests/node_compat/runner` dir instead.
|
||||
|
||||
|
@ -812,6 +812,8 @@ NOTE: This file should not be manually edited. Please edit `tests/node_compat/co
|
|||
- [parallel/test-http-agent-destroyed-socket.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-destroyed-socket.js)
|
||||
- [parallel/test-http-agent-domain-reused-gc.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-domain-reused-gc.js)
|
||||
- [parallel/test-http-agent-error-on-idle.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-error-on-idle.js)
|
||||
- [parallel/test-http-agent-false.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-false.js)
|
||||
- [parallel/test-http-agent-keepalive-delay.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-keepalive-delay.js)
|
||||
- [parallel/test-http-agent-keepalive.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-keepalive.js)
|
||||
- [parallel/test-http-agent-maxsockets-respected.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-maxsockets-respected.js)
|
||||
- [parallel/test-http-agent-maxsockets.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-agent-maxsockets.js)
|
||||
|
@ -868,6 +870,7 @@ NOTE: This file should not be manually edited. Please edit `tests/node_compat/co
|
|||
- [parallel/test-http-client-set-timeout.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-set-timeout.js)
|
||||
- [parallel/test-http-client-spurious-aborted.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-spurious-aborted.js)
|
||||
- [parallel/test-http-client-timeout-agent.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-timeout-agent.js)
|
||||
- [parallel/test-http-client-timeout-connect-listener.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-timeout-connect-listener.js)
|
||||
- [parallel/test-http-client-timeout-event.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-timeout-event.js)
|
||||
- [parallel/test-http-client-timeout-on-connect.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-timeout-on-connect.js)
|
||||
- [parallel/test-http-client-timeout-option-listeners.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-client-timeout-option-listeners.js)
|
||||
|
@ -885,6 +888,7 @@ NOTE: This file should not be manually edited. Please edit `tests/node_compat/co
|
|||
- [parallel/test-http-destroyed-socket-write2.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-destroyed-socket-write2.js)
|
||||
- [parallel/test-http-dns-error.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-dns-error.js)
|
||||
- [parallel/test-http-double-content-length.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-double-content-length.js)
|
||||
- [parallel/test-http-dump-req-when-res-ends.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-dump-req-when-res-ends.js)
|
||||
- [parallel/test-http-early-hints-invalid-argument.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-early-hints-invalid-argument.js)
|
||||
- [parallel/test-http-early-hints.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-early-hints.js)
|
||||
- [parallel/test-http-exceptions.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-exceptions.js)
|
||||
|
@ -896,6 +900,7 @@ NOTE: This file should not be manually edited. Please edit `tests/node_compat/co
|
|||
- [parallel/test-http-header-badrequest.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-header-badrequest.js)
|
||||
- [parallel/test-http-header-overflow.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-header-overflow.js)
|
||||
- [parallel/test-http-host-header-ipv6-fail.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-host-header-ipv6-fail.js)
|
||||
- [parallel/test-http-hostname-typechecking.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-hostname-typechecking.js)
|
||||
- [parallel/test-http-incoming-matchKnownFields.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-incoming-matchKnownFields.js)
|
||||
- [parallel/test-http-incoming-message-connection-setter.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-incoming-message-connection-setter.js)
|
||||
- [parallel/test-http-incoming-message-options.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-http-incoming-message-options.js)
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const http = require('http');
|
||||
|
||||
// Sending `agent: false` when `port: null` is also passed in (i.e. the result
|
||||
// of a `url.parse()` call with the default port used, 80 or 443), should not
|
||||
// result in an assertion error...
|
||||
const opts = {
|
||||
host: '127.0.0.1',
|
||||
port: null,
|
||||
path: '/',
|
||||
method: 'GET',
|
||||
agent: false
|
||||
};
|
||||
|
||||
// We just want an "error" (no local HTTP server on port 80) or "response"
|
||||
// to happen (user happens ot have HTTP server running on port 80).
|
||||
// As long as the process doesn't crash from a C++ assertion then we're good.
|
||||
const req = http.request(opts);
|
||||
|
||||
// Will be called by either the response event or error event, not both
|
||||
const oneResponse = common.mustCall();
|
||||
req.on('response', oneResponse);
|
||||
req.on('error', oneResponse);
|
||||
req.end();
|
|
@ -1,43 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const { Agent } = require('_http_agent');
|
||||
|
||||
const agent = new Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 1000,
|
||||
});
|
||||
|
||||
const server = http.createServer(common.mustCall((req, res) => {
|
||||
res.end('ok');
|
||||
}));
|
||||
|
||||
server.listen(0, common.mustCall(() => {
|
||||
const createConnection = agent.createConnection;
|
||||
agent.createConnection = (options, ...args) => {
|
||||
assert.strictEqual(options.keepAlive, true);
|
||||
assert.strictEqual(options.keepAliveInitialDelay, agent.keepAliveMsecs);
|
||||
return createConnection.call(agent, options, ...args);
|
||||
};
|
||||
http.get({
|
||||
host: 'localhost',
|
||||
port: server.address().port,
|
||||
agent: agent,
|
||||
path: '/'
|
||||
}, common.mustCall((res) => {
|
||||
// for emit end event
|
||||
res.on('data', () => {});
|
||||
res.on('end', () => {
|
||||
server.close();
|
||||
});
|
||||
}));
|
||||
}));
|
|
@ -1,49 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
// This test ensures that `ClientRequest.prototype.setTimeout()` does
|
||||
// not add a listener for the `'connect'` event to the socket if the
|
||||
// socket is already connected.
|
||||
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
// Maximum allowed value for timeouts.
|
||||
const timeout = 2 ** 31 - 1;
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
res.end();
|
||||
});
|
||||
|
||||
server.listen(0, common.mustCall(() => {
|
||||
const agent = new http.Agent({ keepAlive: true, maxSockets: 1 });
|
||||
const options = { port: server.address().port, agent: agent };
|
||||
|
||||
doRequest(options, common.mustCall(() => {
|
||||
const req = doRequest(options, common.mustCall(() => {
|
||||
agent.destroy();
|
||||
server.close();
|
||||
}));
|
||||
|
||||
req.on('socket', common.mustCall((socket) => {
|
||||
assert.strictEqual(socket.listenerCount('connect'), 0);
|
||||
}));
|
||||
}));
|
||||
}));
|
||||
|
||||
function doRequest(options, callback) {
|
||||
const req = http.get(options, (res) => {
|
||||
res.on('end', callback);
|
||||
res.resume();
|
||||
});
|
||||
|
||||
req.setTimeout(timeout);
|
||||
return req;
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const { mustCall } = require('../common');
|
||||
|
||||
const fs = require('fs');
|
||||
const http = require('http');
|
||||
const { strictEqual } = require('assert');
|
||||
|
||||
const server = http.createServer(mustCall(function(req, res) {
|
||||
strictEqual(req.socket.listenerCount('data'), 1);
|
||||
req.socket.once('data', mustCall(function() {
|
||||
// Ensure that a chunk of data is received before calling `res.end()`.
|
||||
res.end('hello world');
|
||||
}));
|
||||
// This checks if the request gets dumped
|
||||
// resume will be triggered by res.end().
|
||||
req.on('resume', mustCall(function() {
|
||||
// There is no 'data' event handler anymore
|
||||
// it gets automatically removed when dumping the request.
|
||||
strictEqual(req.listenerCount('data'), 0);
|
||||
req.on('data', mustCall());
|
||||
}));
|
||||
|
||||
// We explicitly pause the stream
|
||||
// so that the following on('data') does not cause
|
||||
// a resume.
|
||||
req.pause();
|
||||
req.on('data', function() {});
|
||||
|
||||
// Start sending the response.
|
||||
res.flushHeaders();
|
||||
}));
|
||||
|
||||
server.listen(0, mustCall(function() {
|
||||
const req = http.request({
|
||||
method: 'POST',
|
||||
port: server.address().port
|
||||
});
|
||||
|
||||
// Send the http request without waiting
|
||||
// for the body.
|
||||
req.flushHeaders();
|
||||
|
||||
req.on('response', mustCall(function(res) {
|
||||
// Pipe the body as soon as we get the headers of the
|
||||
// response back.
|
||||
fs.createReadStream(__filename).pipe(req);
|
||||
|
||||
res.resume();
|
||||
|
||||
// On some platforms the `'end'` event might not be emitted because the
|
||||
// socket could be destroyed by the other peer while data is still being
|
||||
// sent. In this case the 'aborted'` event is emitted instead of `'end'`.
|
||||
// `'close'` is used here because it is always emitted and does not
|
||||
// invalidate the test.
|
||||
res.on('close', function() {
|
||||
server.close();
|
||||
});
|
||||
}));
|
||||
|
||||
req.on('error', function() {
|
||||
// An error can happen if there is some data still
|
||||
// being sent, as the other side is calling .destroy()
|
||||
// this is safe to ignore.
|
||||
});
|
||||
}));
|
|
@ -1,49 +0,0 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 20.11.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
// All of these values should cause http.request() to throw synchronously
|
||||
// when passed as the value of either options.hostname or options.host
|
||||
const vals = [{}, [], NaN, Infinity, -Infinity, true, false, 1, 0, new Date()];
|
||||
|
||||
vals.forEach((v) => {
|
||||
const received = common.invalidArgTypeHelper(v);
|
||||
assert.throws(
|
||||
() => http.request({ hostname: v }),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
message: 'The "options.hostname" property must be of ' +
|
||||
'type string or one of undefined or null.' +
|
||||
received
|
||||
}
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => http.request({ host: v }),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
message: 'The "options.host" property must be of ' +
|
||||
'type string or one of undefined or null.' +
|
||||
received
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// These values are OK and should not throw synchronously.
|
||||
// Only testing for 'hostname' validation so ignore connection errors.
|
||||
const dontCare = () => {};
|
||||
['', undefined, null].forEach((v) => {
|
||||
http.request({ hostname: v }).on('error', dontCare).end();
|
||||
http.request({ host: v }).on('error', dontCare).end();
|
||||
});
|
Loading…
Add table
Reference in a new issue